Boost logo

Boost Users :

Subject: Re: [Boost-users] Condition Variable and optimization
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2011-12-16 04:14:27


On 12/15/2011 12:56 PM, Steven Watanabe wrote:
>> This needs to declare data_ready as mutable, so the compiler doesn't

Oops, I meant 'volatile'

> cond.wait() does block, but spurious wakeups
> are allowed, hence the loop.

Where is that explained, I read,
"If any threads are currently blocked waiting on *this in a call to wait or timed_wait,
unblocks one of those threads. "

It does not say anything like "and blocks the current thread...", along with some
explanation of when it gets unblocked.

> If the compiler doesn't know anything about
> condition variables, it will see an opaque
> function call that can potentially clobber
> any non-local variables.

I see, thanks.

> It already exists.

Ah, I missed it.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net