From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Slacik To: Ross Johnson Cc: Pthreads Developers List Subject: Re: Pthreads over Win32 / Condition Variables (fwd) Date: Fri, 15 Oct 1999 05:25:00 -0000 Message-id: <38071BF8.1D42C185@TatraMed.sk> References: X-SW-Source: 1999/msg00107.html Ross Johnson wrote: > [...] looking at the code I've found another bug nearby. > > The internal routine Cond_timedwait, called by pthread_cond_wait and > pthread_cond_timedwait, is a cancelation point. In case the thread > is canceled while it's waiting, the code pushes a cleanup handler > (actually just pthread_mutex_lock) to re-lock the mutex associated > with the CV. At the moment this is all it does. > > The canceled waiting thread doesn't decrement the waiting threads > count (cv->waiters) and so the count will never get back to zero, > and the true last waiter will never notify the broadcasting thread. > > I suspect the cleanup handler also needs to check if a broadcast is > in effect and if it's the last waiting thread, and finish off the > broadcast if it is. Lorin Hochstein already informed about this problem (Wed, 30 Jun 1999) and submitted a bugfix. Ross, please check my reply (Thu, 01 Jul 1999) too. -- Peter Slacik