Subject: Re: [boost] [thread] Timed waits in Boost.Thread potentiallyfundamentally broken on Windows (possibly rest of Boost too)
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-23 10:45:10
Niall Douglas wrote:
> The standard says nothing about what is or is not a spurious wakeup
What does it matter? We all know what is or is not a spurious wakeup - a
return from the wait without the condition being notified.
> My reading of
> says that the timed wait may not return timed out if abstime has not
Correct, if it returns before abstime has passed, it returns 0, not
> Unfortunately abstime is measured against the system clock which may
> arbitrarily move around, but that's the POSIX definition.
abstime is measured against the condition variable's clock, which is the
system clock by default, but can be changed. But this is irrelevant.
> For example, would the community be happy if on Windows timed waits always
> were at least the timeout interval requested?
Code that works in the presence of spurious wakeups will retry the wait on
its own. So the only people who would be helped would be those whose code
doesn't expect spurious wakeups. We've been here before. Such code is simply
We know that "the community" would prefer for spurious wakeups to not exist,
and in fact often pretends that they do not. But that's just wrong.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk