summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-02-18 18:50:18 -0500
committerRyan Lortie <desrt@desrt.ca>2014-02-20 17:55:09 -0500
commit1de36e775599e77f2fe47b381f0e5b1b62e93f66 (patch)
tree87e3fefc1909feb5a672a842ba693371206f8943 /configure.ac
parentd61431254636b9ecc250884eb34757c2504e5685 (diff)
downloadglib-1de36e775599e77f2fe47b381f0e5b1b62e93f66.tar.gz
glib-1de36e775599e77f2fe47b381f0e5b1b62e93f66.tar.bz2
glib-1de36e775599e77f2fe47b381f0e5b1b62e93f66.zip
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
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 4 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 29c9f203c..4fdd30a40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2235,23 +2235,14 @@ AS_IF([ test x"$have_threads" = xposix], [
AC_DEFINE(HAVE_PTHREAD_CONDATTR_SETCLOCK,1,
[Have function pthread_condattr_setclock])],
[AC_MSG_RESULT(no)])
- AC_MSG_CHECKING(for pthread_cond_timedwait_monotonic)
+ AC_MSG_CHECKING(for pthread_cond_timedwait_relative_np)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <pthread.h>],
- [pthread_cond_timedwait_monotonic(NULL, NULL, NULL)])],
+ [pthread_cond_timedwait_relative_np(NULL, NULL, NULL)])],
[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC,1,
- [Have function pthread_cond_timedwait_monotonic])],
- [AC_MSG_RESULT(no)])
- AC_MSG_CHECKING(for pthread_cond_timedwait_monotonic_np)
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [#include <pthread.h>],
- [pthread_cond_timedwait_monotonic_np(NULL, NULL, NULL)])],
- [AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC_NP,1,
- [Have function pthread_cond_timedwait_monotonic_np])],
+ AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP,1,
+ [Have function pthread_cond_timedwait_relative_np])],
[AC_MSG_RESULT(no)])
CPPFLAGS="$glib_save_CPPFLAGS"
])