This is the mail archive of the
pthreads-win32@sourceware.cygnus.com
mailing list for the pthreas-win32 project.
cancelling a thread blocked in pthread_cond_wait
- To: pthreads mailing list <pthreads-win32@sourceware.cygnus.com>
- Subject: cancelling a thread blocked in pthread_cond_wait
- From: Lorin Hochstein <lmh@xiphos.ca>
- Date: Wed, 30 Jun 1999 13:34:55 -0400
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