mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-27 19:38:55 +02:00
gthread: Use pthread_cond_timedwait_monotonic() if available
Otherwise we have to rely on pthread_cond_timedwait() actually using the monotonic clock, which might be true or not. On Android at least it is using the realtime clock, no pthread_condattr_setclock() is available but instead pthread_cond_timedwait_monotonic() can be used.
This commit is contained in:
18
configure.ac
18
configure.ac
@@ -2383,6 +2383,24 @@ 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_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"
|
||||
])
|
||||
|
||||
|
Reference in New Issue
Block a user