2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-23 18:12:12 +00:00
David Olsen 047205fbbd Fix sleep_until() to use a realtime clock
boost::this_thread::no_interruption_point::hidden::sleep_until() takes an absolute time as a parameter and converts it to a duration for the length of time to sleep.  But the current time that the absolute time is compared against came from timespec_now(), which, on Linux at least, uses CLOCK_MONOTONIC, which "represents monotonic time since some unspecified starting point."  Since timespec_now() may have a different starting point than the time that was passed to sleep_until(), that can result in sleep_until() sleeping for an *extremely* long time, causing the program to appear to hang.

Change sleep_until() to get the current time from timespec_now_realtime(), which uses CLOCK_REALTIME, which has the same epoch as the time that is passed to sleep_until().
2017-08-02 15:19:32 -07:00
2016-07-16 19:50:46 +03:00
2017-06-11 11:30:59 +02:00
2014-06-10 00:18:36 +01:00
2017-05-10 13:12:01 +08:00
2001-06-15 15:27:08 +00:00
2014-10-11 07:33:57 +02:00
2016-11-05 23:37:45 +01:00

thread

Portable C++ multi-threading. C++11, C++14.

License

Distributed under the Boost Software License, Version 1.0.

Description
Mirrored via gitea-mirror
Readme 11 MiB
Languages
C++ 99.9%