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_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>],
+ [pthread_cond_timedwait_monotonic(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_MSG_RESULT(no)])
CPPFLAGS="$glib_save_CPPFLAGS"
])
ts.tv_sec = end_time / 1000000;
ts.tv_nsec = (end_time % 1000000) * 1000;
+#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
+ if ((status = pthread_cond_timedwait_monotonic (g_cond_get_impl (cond), g_mutex_get_impl (mutex), &ts)) == 0)
+ return TRUE;
+#elif defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC_NP)
+ if ((status = pthread_cond_timedwait_monotonic_np (g_cond_get_impl (cond), g_mutex_get_impl (mutex), &ts)) == 0)
+ return TRUE;
+#else
+ /* Pray that the cond is actually using the monotonic clock */
if ((status = pthread_cond_timedwait (g_cond_get_impl (cond), g_mutex_get_impl (mutex), &ts)) == 0)
return TRUE;
+#endif
if G_UNLIKELY (status != ETIMEDOUT)
g_thread_abort (status, "pthread_cond_timedwait");