From cff875eeb01c491fb0cf47339149db3d0fe0d4d8 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Tue, 6 Jan 2015 21:25:42 -0500 Subject: [PATCH] Remove test for pthread_mutex_timedlock(). --- configure.ac | 8 -------- src/mutex.h | 27 ++++----------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/configure.ac b/configure.ac index 48fd61fb..b9b62b48 100644 --- a/configure.ac +++ b/configure.ac @@ -38,14 +38,6 @@ CC="$PTHREAD_CC" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" -acx_pthread_mutex_timedlock_ok=no -AC_MSG_CHECKING([for pthread_mutex_timedlock()]) -AC_TRY_LINK_FUNC(pthread_mutex_timedlock, acx_pthread_mutex_timedlock_ok=yes) -AC_MSG_RESULT($acx_pthread_mutex_timedlock_ok) -if test x"$acx_pthread_mutex_timedlock_ok" = "xyes"; then - AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK, 1, [Define if your OS has pthread_mutex_timedlock().]) -fi - acx_pthread_testcancel_ok=no AC_MSG_CHECKING([for pthread_testcancel()]) AC_TRY_LINK_FUNC(pthread_testcancel, acx_pthread_testcancel_ok=yes) diff --git a/src/mutex.h b/src/mutex.h index 31622e39..17adfff4 100644 --- a/src/mutex.h +++ b/src/mutex.h @@ -24,11 +24,11 @@ #include #endif -/* Cant test thread cancellation so disable it for now. usleep() is a POSIX - * cancellation point. */ -#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK +#ifdef HAVE_SYS_TIME_H +#include +#endif -#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK +#ifdef HAVE_TIME_H #include #endif @@ -75,24 +75,6 @@ pthread_mutex_unlock(m); \ } while (0) -#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK -#define MUTEX_TIMED_LOCK(m, timeout, rc) do { \ - struct timespec ts; \ - INIT_TIMESPEC(timeout, ts); \ - int n = pthread_mutex_timedlock(m, &ts); \ - if (n == ETIMEDOUT) { \ - rc = GPG_ERR_LOCKED; \ - } \ - else if (!n) { \ - MUTEX_LOCK_DEBUG(m); \ - } \ - else { \ - log_write("%s(%i): %s", __FILE__, __LINE__, \ - pwmd_strerror(gpg_error_from_errno(n))); \ - rc = gpg_error_from_errno(n); \ - } \ - } while (0) -#else #define TIMED_LOCK_DURATION 100000 #define MUTEX_TIMED_LOCK(ctx, m, timeout, rc) do { \ long ka = (long)config_get_integer ("global", "keepalive_interval"); \ @@ -115,7 +97,6 @@ } \ } \ } while (0) -#endif #define MUTEX_TRYLOCK(ctx, m, rc, t) do { \ int n; \ -- 2.11.4.GIT