Boost logo

Boost :

From: Preston A. Elder (prez_at_[hidden])
Date: 2007-11-14 07:27:44


On Wed, 14 Nov 2007 13:23:05 +0100, Alexander Terekhov wrote:

> Anthony Williams wrote:
> t0: thread A holds the lock
> t1: thread B calls lock() and does internal try_lock() twice (both fail)
> t2: thread A calls unlock() and does notify_all() (nobody's waiting) t3:
> thread B enters wait() on condvar and waits and waits and waits...
>
> albeit interruptably. :-)
>
> regards,
> alexander.

This would be easily fixed by getting it to lock the internal lock on
unlock (before the notify_all). Doing so would mean that the notify_all
could not happen until B is in the wait.

Thanks for noticing, an easy bug to fix though :)

PreZ :)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk