[tsan] fix deadlock detector's interoperation with java locks (https://code.google.com/p/thread-sanitizer/issues/detail?id=67)

llvm-svn: 212529
This commit is contained in:
Kostya Serebryany 2014-07-08 13:16:03 +00:00
parent 324ad956e0
commit 3d570b960e
1 changed files with 1 additions and 1 deletions

View File

@ -172,7 +172,7 @@ void MutexLock(ThreadState *thr, uptr pc, uptr addr, int rec, bool try_lock) {
}
s->recursion += rec;
thr->mset.Add(s->GetId(), true, thr->fast_state.epoch());
if (flags()->detect_deadlocks && s->recursion == 1) {
if (flags()->detect_deadlocks && (s->recursion - rec) == 0) {
Callback cb(thr, pc);
if (!try_lock)
ctx->dd->MutexBeforeLock(&cb, &s->dd, true);