Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-09-01 14:18:08


On Mon, Sep 1, 2008 at 8:00 PM, Stjepan Rajko <stipe_at_[hidden]> wrote:
> On Mon, Sep 1, 2008 at 10:50 AM, Giovanni Piero Deretta
> <gpderetta_at_[hidden]> wrote:
>>
>> Spurious wakeups are rare in practice. OTOH, what is more likely to
>> happen is that the main thread could miss the wake-up if the worker
>> thread managed to signal the condition variable before the main thread
>> got to wait for it (remember that condition variables are stateless).
>>
>
> Wouldn't the mutex lock have taken care of that? asio_server blocks
> before notifying, and the main thread doesn't release the mutex until
> getting to the wait point.
>

Yes, you a right. It can fail only because of a spurious wakeup.

-- 
gpd

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