... | ... | @@ -6,3 +6,25 @@ config.mk is incorporated |
|
|
|
|
|
pthread_cancel() undefined in bionic
|
|
|
Backgrounder: https://groups.google.com/forum/#!topic/android-platform/Cq05PaLaZbE
|
|
|
|
|
|
> the pthread support in Bionic is restricted to the set of things we needed to get the platform running.
|
|
|
Except for a few exceptions, if something is not there, feel free to file a feature request or even better provide a patch for it.
|
|
|
>
|
|
|
NOTE: pthread_cancel() is part of the exceptions and is *not* going to be supported
|
|
|
|
|
|
Suggested fix:
|
|
|
>>>
|
|
|
Try changing your code so that your threads don't get stuck waiting
|
|
|
indefinitely for i/o. For example used conditional variables, select
|
|
|
or poll to wait for events, and be sure to create a 'stop-the-thread
|
|
|
event'. That's how any properly written code should be anyway
|
|
|
Another more rustic alternative is to either close/shutdown the file
|
|
|
descriptor or resource the thread is waiting on, or even use
|
|
|
pthread-kill to send a signal to the thread, since this sill make the
|
|
|
system call return with EINTR (you need to unblock the signal first
|
|
|
though)
|
|
|
|
|
|
In all cases, be sure to properly release resources when exiting thr
|
|
|
thread. 99% of the code that uses pthread_cancel I have seen leaks
|
|
|
memory, or even locks, in certain circumstances.
|
|
|
>>> |
|
|
\ No newline at end of file |