aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/threading/mutex.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2009-12-08 18:24:40 +0100
committerTobias Brunner <tobias@strongswan.org>2009-12-23 17:02:25 +0100
commit866dc0134a27a14b7d85739c221259a832d313b8 (patch)
tree422de0d72149464a437f86a3c4c63d3ac7de720d /src/libstrongswan/threading/mutex.c
parentc33d4f29bc4f9a6667fa437d8630e462cc05c899 (diff)
downloadstrongswan-866dc0134a27a14b7d85739c221259a832d313b8.tar.bz2
strongswan-866dc0134a27a14b7d85739c221259a832d313b8.tar.xz
Check for pthread_condattr_init added to configure script.
Diffstat (limited to 'src/libstrongswan/threading/mutex.c')
-rw-r--r--src/libstrongswan/threading/mutex.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libstrongswan/threading/mutex.c b/src/libstrongswan/threading/mutex.c
index d05b8674e..0bfe06959 100644
--- a/src/libstrongswan/threading/mutex.c
+++ b/src/libstrongswan/threading/mutex.c
@@ -341,7 +341,6 @@ condvar_t *condvar_create(condvar_type_t type)
case CONDVAR_TYPE_DEFAULT:
default:
{
- pthread_condattr_t condattr;
private_condvar_t *this = malloc_thing(private_condvar_t);
this->public.wait = (void(*)(condvar_t*, mutex_t *mutex))_wait;
@@ -351,12 +350,17 @@ condvar_t *condvar_create(condvar_type_t type)
this->public.broadcast = (void(*)(condvar_t*))broadcast;
this->public.destroy = (void(*)(condvar_t*))condvar_destroy;
- pthread_condattr_init(&condattr);
+#ifdef HAVE_PTHREAD_CONDATTR_INIT
+ {
+ pthread_condattr_t condattr;
+ pthread_condattr_init(&condattr);
#ifdef HAVE_CONDATTR_CLOCK_MONOTONIC
- pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
+ pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
+#endif
+ pthread_cond_init(&this->condvar, &condattr);
+ pthread_condattr_destroy(&condattr);
+ }
#endif
- pthread_cond_init(&this->condvar, &condattr);
- pthread_condattr_destroy(&condattr);
return &this->public;
}