This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] condition_variable: Report early wakeup of wait_until as no_timeout

On 20/07/18 12:30 +0100, Mike Crowe wrote:
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.


There are "broken" clocks in testsuite/30_threads/this_thread/
and testsuite/30_threads/timed_mutex/try_lock_until/ but I'm
not sure if either of them is reusable. A custom one for this test
should be reasonably easy.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]