diff options
author | Martin Willi <martin@revosec.ch> | 2012-08-20 17:58:58 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-08-20 18:01:20 +0200 |
commit | 88a5abf5e202b4aedae85a7891b759fe15b6198a (patch) | |
tree | 6dccdd90447eecfc8d012dc635ec4f5d032c8f50 /src/libstrongswan | |
parent | 10bdc7a96848d230e9c2fd57d25585a2734862f6 (diff) | |
download | strongswan-88a5abf5e202b4aedae85a7891b759fe15b6198a.tar.bz2 strongswan-88a5abf5e202b4aedae85a7891b759fe15b6198a.tar.xz |
Don't use POSIX semaphores if a MONOTONIC clock is available
POSIX semaphores use CLOCK_REALTIME, but our semaphore_t abstraction
expects CLOCK_MONOTONIC based times. Use the mutex/condvar based
fallback if time_monotonic() actuall returns monotonic times.
Diffstat (limited to 'src/libstrongswan')
-rw-r--r-- | src/libstrongswan/threading/semaphore.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstrongswan/threading/semaphore.c b/src/libstrongswan/threading/semaphore.c index c35cf1ea5..b785ff944 100644 --- a/src/libstrongswan/threading/semaphore.c +++ b/src/libstrongswan/threading/semaphore.c @@ -15,6 +15,14 @@ #include <library.h> +#if defined(HAVE_CLOCK_GETTIME) && \ + (defined(HAVE_CONDATTR_CLOCK_MONOTONIC) || \ + defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)) +/* if we use MONOTONIC times, we can't use POSIX_SEMAPHORES since they use + * times based on CLOCK_REALTIME */ +#undef HAVE_SEM_TIMEDWAIT +#endif /* HAVE_CLOCK_GETTIME && ... */ + #ifdef HAVE_SEM_TIMEDWAIT #include <semaphore.h> #else /* !HAVE_SEM_TIMEDWAIT */ |