From 22407294e24aca91e74dd6c1b35e17c3c954b12d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 28 Jun 2008 16:42:16 +0000 Subject: [PATCH] Bug fix: only complain about recursive locking before pthread_cond_wait() is called if the calling thread holds the lock. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8302 --- exp-drd/drd_cond.c | 2 +- exp-drd/tests/tc23_bogus_condwait.stderr.exp | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/exp-drd/drd_cond.c b/exp-drd/drd_cond.c index c5b04a4b77..e550fa61cb 100644 --- a/exp-drd/drd_cond.c +++ b/exp-drd/drd_cond.c @@ -219,7 +219,7 @@ int cond_pre_wait(const Addr cond, const Addr mutex) } tl_assert(p->mutex); q = mutex_get(p->mutex); - if (q && q->recursion_count > 0) + if (q && q->owner == thread_get_running_tid() && q->recursion_count > 0) { const ThreadId vg_tid = VG_(get_running_tid)(); MutexErrInfo MEI = { q->a1, q->recursion_count, q->owner }; diff --git a/exp-drd/tests/tc23_bogus_condwait.stderr.exp b/exp-drd/tests/tc23_bogus_condwait.stderr.exp index d1911d407c..3b0a93a1e5 100644 --- a/exp-drd/tests/tc23_bogus_condwait.stderr.exp +++ b/exp-drd/tests/tc23_bogus_condwait.stderr.exp @@ -53,10 +53,6 @@ Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 2 at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:78) -Mutex locked recursively: mutex 0x........, recursion count 1, owner 2. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:78) - Thread 3: Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread. at 0x........: pthread_cond_signal* (drd_pthread_intercepts.c:?) @@ -77,4 +73,4 @@ Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1 by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) -ERROR SUMMARY: 12 errors from 12 contexts (suppressed: 0 from 0) +ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0) -- 2.47.2