summaryrefslogtreecommitdiff
path: root/threading_pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'threading_pthread.c')
-rw-r--r--threading_pthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/threading_pthread.c b/threading_pthread.c
index e6b9df9c..00712266 100644
--- a/threading_pthread.c
+++ b/threading_pthread.c
@@ -180,7 +180,11 @@ int
cond_wait (uintptr_t c, uintptr_t m) {
pthread_cond_t *cond = (pthread_cond_t *)c;
pthread_mutex_t *mutex = (pthread_mutex_t *)m;
- int err = pthread_cond_wait (cond, mutex);
+ int err = mutex_lock (m);
+ if (err != 0) {
+ return err;
+ }
+ err = pthread_cond_wait (cond, mutex);
if (err != 0) {
fprintf (stderr, "pthread_cond_wait failed: %s\n", strerror (err));
}