diff options
author | Kostya Serebryany <kcc@google.com> | 2014-02-18 12:50:31 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-02-18 12:50:31 +0000 |
commit | 58e61fb3e9f76d59e817ede94ac5f3420bf328b9 (patch) | |
tree | 16b22cece4bebb759c2520f787167586a9a615a9 /lib | |
parent | 00ec5f1d345b524f99ba18a7129f174ea7a5cc55 (diff) |
[tsan] in deadlock detector do not register locks on their creation and unregister them on destruction; added a relevant test
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tsan/rtl/tsan_rtl_mutex.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/tsan/rtl/tsan_rtl_mutex.cc b/lib/tsan/rtl/tsan_rtl_mutex.cc index bb471b02c..5d54a4214 100644 --- a/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -45,10 +45,6 @@ void MutexCreate(ThreadState *thr, uptr pc, uptr addr, s->is_rw = rw; s->is_recursive = recursive; s->is_linker_init = linker_init; - if (common_flags()->detect_deadlocks) { - EnsureDeadlockDetectorID(thr, s); - Printf("MutexCreate: %zx\n", s->deadlock_detector_id); - } s->mtx.Unlock(); } @@ -66,8 +62,9 @@ void MutexDestroy(ThreadState *thr, uptr pc, uptr addr) { if (s == 0) return; if (common_flags()->detect_deadlocks) { - EnsureDeadlockDetectorID(thr, s); - Printf("MutexDestroy: %zx\n", s->deadlock_detector_id); + if (s->deadlock_detector_id) + g_deadlock_detector.removeNode(s->deadlock_detector_id); + s->deadlock_detector_id = 0; } if (IsAppMem(addr)) { CHECK(!thr->is_freeing); @@ -169,7 +166,7 @@ int MutexUnlock(ThreadState *thr, uptr pc, uptr addr, bool all) { thr->mset.Del(s->GetId(), true); if (common_flags()->detect_deadlocks) { EnsureDeadlockDetectorID(thr, s); - Printf("MutexUnlock: %zx\n", s->deadlock_detector_id); + // Printf("MutexUnlock: %zx\n", s->deadlock_detector_id); g_deadlock_detector.onUnlock(&thr->deadlock_detector_tls, s->deadlock_detector_id); } |