Closed jerryhuangcc closed 1 month ago
timed_receive expects an absolute time and you are passing a duration. In any case, even if an absolute time is passed that depends on which time the underlying operating system uses. In POSIX systems, the default clock is the real-time clock (CLOCK_REALTIME):
https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cond_timedwait.html
In some recent systems (Linux) it might be possible to configure POSIX condition variables to use CLOCK_MONOTONIC instead but in any case, we can't have a general guarantee about steady clock (monotonic) support.
In my project, I use
message_queue::timed_receive
to handle inter process messaging.But in issue scenario, my system clock falled back to 2mins, then
timed_receive
waited for more than 1s already set in code. This behaviour is not expected.My question is for
message_queue::timed_receive
, does it support steady_clock which is not affected bysystem time
update?