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]

Re: Pthreads over Win32 / Condition Variables (fwd)


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 <lmh@xiphos.ca> 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




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