]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Modified code such that concurrent pthread_cond_wait() and pthread_destroy() calls...
authorBart Van Assche <bvanassche@acm.org>
Sat, 28 Jun 2008 16:55:35 +0000 (16:55 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 28 Jun 2008 16:55:35 +0000 (16:55 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8304

exp-drd/drd_cond.c

index e550fa61cb07eeb0bc0300d5c5af8e14f9d8ac3e..219f7b3fb6925404e6eba003f586c1f4489b26d8 100644 (file)
@@ -252,16 +252,19 @@ int cond_post_wait(const Addr cond)
   }
 
   p = cond_get(cond);
-  // To do: print a proper error message if the assert below fails.
-  tl_assert(p);
-  // To do: print a proper error message if the assert below fails.
-  tl_assert(p->waiter_count > 0);
-  tl_assert(p->mutex);
-  if (--p->waiter_count == 0)
+  if (p)
   {
-    p->mutex = 0;
+    if (p->waiter_count > 0)
+    {
+      --p->waiter_count;
+      if (p->waiter_count == 0)
+      {
+        p->mutex = 0;
+      }
+    }
+    return p->waiter_count;
   }
-  return p->waiter_count;
+  return 0;
 }
 
 static void cond_signal(Addr const cond)