Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Issues with pthread_cancel(): (2 Items)
   
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
Re: Issues with pthread_cancel()  
My bad. The pub_thread was not being terminated, but blocking in a semaphore. All is working great. Sorry for the noise.


- Jefferson