hi,
if there is three threads a,b,c :
what happens if thread a cancels thread b ,
but at the same time b is waiting for join thread c .
who is responsible for joining c and what happens to b ?
thnx
hi,
if there is three threads a,b,c :
what happens if thread a cancels thread b ,
but at the same time b is waiting for join thread c .
who is responsible for joining c and what happens to b ?
thnx
What do you think happens? Why do you think that? Did you read the documentation (man pages) for pthread_join and pthread_cancel? Have you tried writing a test program to see what happens?
EDIT: This site is a pretty useful pthreads reference: https://computing.llnl.gov/tutorials/pthreads/.
Last edited by anduril462; 01-04-2012 at 04:26 PM.
General Information
>>who is responsible for joining c
You are.
>>... what happens to b ?
We need actual code to answer these questions.
gg
pthread_join() is a cancellation point. So if thread b is attempting to join thread c, and is cancelled before thread c exits, then the join is aborted and some other thread will have to join thread c. If the thread is not joined its resources will not be released.
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}