This is the mail archive of the pthreads-win32@sourceware.cygnus.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cancelling a thread blocked in pthread_cond_wait


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]