Martin
Martin

Reputation: 825

Delphi TerminateThread equivalent for Android

I have been discussing a problem on the Indy forums related to a thread that is not terminating correctly under Android. They have suggested that there may be an underlying problem with TThread for ARC.

Because this problem is holding up the release of a product a work around would be to simply forcibly terminate the thread. I know this is not nice but in this case I cant think of a side effect from doing so. Its wrong but its better than a deadlocked app.

Is there a way to forcibly terminate a thread under Android like TerminateThread does under windows?

Martin

Upvotes: 0

Views: 465

Answers (1)

blong
blong

Reputation: 2175

Well, I don't think harshly terminating threads is advisable, but that notwithstanding, from what I read of the System unit, you should be able to use this:

uses Posix.Pthread;
...
pthread_detach(pthread_t(TheThreadObject.ThreadID));

Untested, mind.

Upvotes: 1

Related Questions