[PATCH 1/2] condition_variable: Report early wakeup of wait_until as no_timeout
Mike Crowe
mac@mcrowe.com
Fri Jul 20 11:30:00 GMT 2018
On Friday 20 July 2018 at 11:53:38 +0100, Jonathan Wakely wrote:
> On 10/07/18 11:09 +0100, Mike Crowe wrote:
> > As currently implemented, condition_variable always ultimately waits
> > against std::chrono::system_clock. This clock can be changed in arbitrary
> > ways by the user which may result in us waking up too early or too late
> > when measured against the caller-supplied clock.
> >
> > We can't (yet) do much about waking up too late[1], but
> > if we wake up too early we must return cv_status::no_timeout to indicate a
> > spurious wakeup rather than incorrectly returning cv_status::timeout.
>
> The patch looks good, thanks.
>
> Can we come up with a test for this, using a user-defined clock that
> jumps back?
That's a good idea. I'll do that.
Thanks.
Mike.
More information about the Libstdc++
mailing list