I am porting a mid-sized body of C++ code to Android NDK. Unfortunately the pthreads implementation (as of NDK v5, anyway) is incomplete. Specifically, our application relies on pthread_cancel() to kill a worker thread. NDK does not implement pthread_cancel()! There are other obvious answers when the worker thread is responding normally. But in cases where the worker thread is not responding (e.g. infinite loop), how can I cancel it without killing the whole process?
Share
Possible option that works for this guy: http://igourd.blogspot.com/2009/05/work-around-on-pthreadcancel-for.html
Reposting here in case:
Timer out:
USR1 handler:
Looks like the best answer is to rewrite so that threads aren’t waiting on IO: http://groups.google.com/group/android-platform/browse_thread/thread/0aad393da2da65b1