Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make CLOCK_MONOTONIC handling more precise in pal_threading.c (#50498)
The root cause of the problem in #50388 turned out to be because we do not have `pthread_condattr_setclock(..., CLOCK_MONOTONIC);` on iOS. This caused the timeout argument for `pthread_cond_timedwait` to be interpreted as an _absolute system time_ (in seconds since the Unix epoch), however the value we got back from `clock_gettime(CLOCK_MONOTONIC, ...)` was actually some value based on the uptime of the system. Since the uptime is much smaller than the system time the wait immediately returned. Harden the handling by adding a check for `HAVE_PTHREAD_CONDATTR_SETCLOCK` like we already do in `SystemNative_LowLevelMonitor_Create()` Co-authored-by: Alexander Köplinger <[email protected]>
- Loading branch information