Jefferson Coelho
|
Issues with pthread_cancel()
|
Jefferson Coelho
03/02/2009 6:03 PM
post23291
|
Issues with pthread_cancel()
[ sorry if this is a duplicate ]
My application’s main thread creates a detached thread via
pthread_create(); its thread ID is pub_thread, and the corresponding execution
routine is run_publish_thread(). Run_publish_thread() never exits, but
occasionally it calls pthread_create() to create another detached thread, with
the id timeout_thread and the execution routine run_timeout_thread().
Run_timeout_thread() executes a nanosleep() as fast as
possible, and never exits, even after the expiration of nanosleep().
Now the issue: the main thread tries to cancel
timeout_thread by calling pthread_cancel(timeout_thread), while timeout_thread
at this point is executing the nanosleep(). The observed behavior is: both
pub_thread *and* timeout_thread are being canceled.
I am executing QNX 6.3.2 in a x86 target.
Any help the community may offer will be greatly
appreciated. Thank you,
- Jefferson
|
|
|