Fix g_cond_wait_until() vs. monotonic time
authorRyan Lortie <desrt@desrt.ca>
Tue, 18 Feb 2014 23:50:18 +0000 (18:50 -0500)
committerRyan Lortie <desrt@desrt.ca>
Thu, 20 Feb 2014 22:55:09 +0000 (17:55 -0500)
commit1de36e775599e77f2fe47b381f0e5b1b62e93f66
tree87e3fefc1909feb5a672a842ba693371206f8943
parentd61431254636b9ecc250884eb34757c2504e5685
Fix g_cond_wait_until() vs. monotonic time

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
configure.ac
glib/gthread-posix.c