cancelling a thread blocked in pthread_cond_wait
Lorin Hochstein
lmh@xiphos.ca
Wed Jun 30 10:35:00 GMT 1999
In my code, I've encountered the following error:
Thread A is cancelled while blocked in pthread_cond_wait. The thread
cleans up and exits.
Thread B enters pthread_cond_wait on the same condition. variable
Thread C calls pthread_cond_broadcast, and blocks inside the function.
If I examine the contents of the pthread_cond_t structure (just before I
call pthread_cond_broadcast), I notice that the "waiters" field is set
to 2! So, even though Thread A was cancelled, it is still registered as
waiting for the condition.
Looking through the pthreads code, I cannot see where the "waiters"
field would be decremented in the event that a cancellation occurs while
blocked in pthread_cond_wait.
Am I missing something fundamental here?
Lorin Hochstein
More information about the Pthreads-win32
mailing list