Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Ben Gamari's avatar
    1f66ba43
    rts/OSThreads: Fix reference clock of timedWaitCondition · 1f66ba43
    Ben Gamari authored
    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. Unfortunately, this is complicated by the fact that older
    versions of Darwin did not provide `clock_gettime`, which means we also
    need to introduce a fallback path using `gettimeofday`.
    
    Fixes #20144.
    
    (cherry picked from commit f454c0ea)
    1f66ba43
    History
    rts/OSThreads: Fix reference clock of timedWaitCondition
    Ben Gamari authored
    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. Unfortunately, this is complicated by the fact that older
    versions of Darwin did not provide `clock_gettime`, which means we also
    need to introduce a fallback path using `gettimeofday`.
    
    Fixes #20144.
    
    (cherry picked from commit f454c0ea)
Code owners
Assign users and groups as approvers for specific file changes. Learn more.