rts/OSThreads: Fix reference clock of timedWaitCondition
Previously timedWaitCondition
assumed that timeouts were
referenced against CLOCK_MONOTONIC
. This is wrong;
by default pthread_cond_timedwait
references against
CLOCK_REALTIME
, although this can be overridden using
pthread_condattr_setclock
.
Fix this and add support for using CLOCK_MONOTONIC
whenever possible as it is more robust against system
time changes and is likely cheaper to query.
Fixes #20144 (closed).
Edited by Ben Gamari