]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Only call pthread_condattr_setclock() if it's available in libpthread.
authorBart Van Assche <bvanassche@acm.org>
Mon, 6 Oct 2008 06:34:20 +0000 (06:34 +0000)
committerBart Van Assche <bvanassche@acm.org>
Mon, 6 Oct 2008 06:34:20 +0000 (06:34 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8648

drd/tests/monitor_example.cpp

index 398426659811fa1a0c2d5f8f2ac65364a817aa51..731b0c4eaf18b833372ca2a574e86ed28eb6e350 100644 (file)
@@ -11,6 +11,7 @@
 #define _GNU_SOURCE 1
 
 
+#include "config.h"
 #include <cassert>
 #include <iostream>
 #include <pthread.h>
@@ -32,8 +33,10 @@ public:
     pthread_mutexattr_destroy(&mutexattr);
     pthread_condattr_t condattr;
     pthread_condattr_init(&condattr);
+#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK)
     pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
-    pthread_cond_init(&m_cond, 0);
+#endif
+    pthread_cond_init(&m_cond, &condattr);
     pthread_condattr_destroy(&condattr);
   }
   ~Monitor()