https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93542

            Bug ID: 93542
           Summary: std::future::wait_for should use monotonic clock
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mac at mcrowe dot com
  Target Milestone: ---

std::future::wait_for calls __atomic_futex_unsigned._M_load_when_equal_for
which calculates an absolute time measured against std::chrono::system_clock.
This results in the timeout changing if the system clock is warped.

std::future::wait_for should behave the same as
std::condition_variable::wait_for and wait against std::chrono::steady_clock.

Similarly, calling std::future::wait_until with a std::chrono::steady_clock
parameter results in a wait against std::chrono::system_clock.

(A fix for this is available in
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01932.html .)

Reply via email to