about summary refs log tree commit diff
path: root/nptl/old_pthread_cond_wait.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/old_pthread_cond_wait.c')
-rw-r--r--nptl/old_pthread_cond_wait.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/nptl/old_pthread_cond_wait.c b/nptl/old_pthread_cond_wait.c
index 3b54faca69..50505a265e 100644
--- a/nptl/old_pthread_cond_wait.c
+++ b/nptl/old_pthread_cond_wait.c
@@ -34,13 +34,18 @@ __pthread_cond_wait_2_0 (cond, mutex)
     {
       pthread_cond_t *newcond;
 
+#if LLL_MUTEX_LOCK_INITIALIZER == 0
+      newcond = (pthread_cond_t *) calloc (sizeof (pthread_cond_t), 1);
+      if (newcond == NULL)
+	return ENOMEM;
+#else
       newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
       if (newcond == NULL)
 	return ENOMEM;
 
-      *newcond = (pthread_cond_t) PTHREAD_COND_INITIALIZER;
-
-      atomic_write_barrier ();
+      /* Initialize the condvar.  */
+      (void) pthread_cond_init (newcond, NULL);
+#endif
 
       if (atomic_compare_and_exchange_acq (&cond->cond, newcond, NULL) != 0)
 	/* Somebody else just initialized the condvar.  */