Skip to content
  • Allison Karlitskaya's avatar
    Fix g_cond_wait_until() vs. monotonic time · 1de36e77
    Allison Karlitskaya authored
    We've had a relatively rocky path with g_cond_wait_until() on systems
    that either don't support pthread_condattr_setclock() or where
    g_get_monotonic_time() is not based on CLOCK_MONOTONIC (ie: Android and
    Mac OS).
    
    Fortunately, both of these platforms seem to share
    pthread_cond_timedwait_relative_np() which allows us to implement
    g_cond_wait_until() without races.
    
    With this patch, we now require that one of pthread_condattr_setclock()
    or pthread_cond_timedwait_relative_np() exists.  A quick look around
    suggests that this is true for all platforms that we care about.
    
    This patch removes our use of pthread_cond_timedwait_monotonic() and
    pthread_cond_timedwait_monotonic_np() which were Android-only APIs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673607
    1de36e77