|
From: Tom H. <th...@cy...> - 2005-01-10 10:45:42
|
CVS commit by thughes:
Broadcast the condition variable instead of signalling because we
want to wake both the threads. Also initialise the mutex and condition
variable properly.
M +3 -3 yield.c 1.3
--- valgrind/none/tests/yield.c #1.2:1.3
@@ -4,6 +4,6 @@
#include <unistd.h>
-static pthread_mutex_t m_go;
-static pthread_cond_t c_go;
+static pthread_mutex_t m_go = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t c_go = PTHREAD_COND_INITIALIZER;
static volatile int alive;
@@ -56,5 +56,5 @@ int main()
pthread_mutex_lock(&m_go);
alive = 1;
- pthread_cond_signal(&c_go);
+ pthread_cond_broadcast(&c_go);
pthread_mutex_unlock(&m_go);
|