This is the mail archive of the
mailing list for the libstdc++ project.
Re: [PATCH 1/2] condition_variable: Report early wakeup of wait_until as no_timeout
- From: Mike Crowe <mac at mcrowe dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 20 Jul 2018 12:30:43 +0100
- Subject: Re: [PATCH 1/2] condition_variable: Report early wakeup of wait_until as no_timeout
- References: <email@example.com> <20180720105338.GQ14057@redhat.com>
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, 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.