mirror of
https://github.com/boostorg/thread.git
synced 2026-01-23 18:12:12 +00:00
047205fbbd488fb83cc7a96d22337ef9e45dbc42
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().
thread
Portable C++ multi-threading. C++11, C++14.
License
Distributed under the Boost Software License, Version 1.0.
Description
Languages
C++
99.9%