wait_until fails with "Invalid argument" when called too soon after reboot
- Dominant language
- C++
- Stars
- 214
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
`wait_until` accepts a time point that may be in the past. This generally works fine unless the time point is before the machine booted up.
The boost implementation will first calculate the difference to the current time: https://github.com/boostorg/thread/blob/boost-1.70.0/include/boost/thread/pthread/condition_variable_fwd.hpp#L270
Right afterward, the difference is added to the internal clock (`detail::internal_chrono_clock::now() + d`). However, the internal clock only starts when the machine was booted up (and not when the unix epoch started). Thus, the resulting timeout that is passed to `do_wait_until` may be negative (in both values, seconds and nanoseconds). Then `pthread_cond_timedwait` throws "Invalid argument".
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.