Bug in pthread_cond_signal under Win NT 4.0

Ken Tew ken2@andrew.cmu.edu
Fri Jul 13 13:10:00 GMT 2001


If you signal a condition variable without any threads actually waiting  
on the condition variable, then when a thread does wait on that variable
it will hang. 

I've attached the file pthread_bug_test.cpp which is a simple program to 
demonstrate the bug.

I also attached a modified thread.cc which fixes the bug.  It simply
checks to see if any threads are waiting on the condition before
signalling.  The only change I made to thread.cc was adding the line: 
  if (waiting) 
at line 452 in the file.  

----------
                                          \//////
                                          [ O o ]
 Ken Tew - Licensed to Program             \_=_/
   http://www.pitt.edu/~ktew               _| |_
                                          / \_/ \
________________________________________oOOO___OOOo__


More information about the Cygwin mailing list