Subject: Re: [boost] [thread] Request review of new synchronisation object, boost::permit<>
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2014-05-06 15:57:43
El 05/05/2014 22:13, Peter Dimov wrote:
> Niall Douglas wrote:
>> Spurious wakeups absolutely can be prevented by the implementation,
> I know.
>> just for backwards compatibility POSIX cannot do so.
> No, the POSIX committee knew that they can be prevented, too.
> What I am saying is that they could have disallowed them when they wrote
> the specification, but did not, on purpose. Code that has problems with
> spurious wakeups also has problems with other corner cases (such as the
> one from my other post); and writing it to handle spurious wakeups takes
> care of these other corner cases as well.
I think spurious wakeups also allow more efficient implementations in
some systems or implementations written in user space. When emulating
condition variables you can't (or it's extremely expensive) to guarantee
that you wake up the waiting thread and that thread can lock the mutex
before anyone can lock and modify the predicate. Similar reasons are
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk