tsan: fix deadlock in deadlock detector

forget to unlock a mutex on one of the paths

llvm-svn: 203663
This commit is contained in:
Dmitry Vyukov 2014-03-12 14:55:20 +00:00
parent 07d949f39a
commit 22196e777c
1 changed files with 3 additions and 1 deletions

View File

@ -157,8 +157,10 @@ typename AddrHashMap<T, kSize>::Cell *AddrHashMap<T, kSize>::acquire(uptr addr,
for (;;) { for (;;) {
Cell *c = &table_[h]; Cell *c = &table_[h];
uptr addr1 = atomic_load(&c->addr, memory_order_acquire); uptr addr1 = atomic_load(&c->addr, memory_order_acquire);
if (addr1 == addr) // another thread has inserted it ahead of us if (addr1 == addr) { // another thread has inserted it ahead of us
c0->mtx.Unlock();
return c; return c;
}
// Skip kLocked, since we hold the home cell mutex, it can't be our elem. // Skip kLocked, since we hold the home cell mutex, it can't be our elem.
if ((addr1 == 0 || addr1 == kRemoved) && if ((addr1 == 0 || addr1 == kRemoved) &&
atomic_compare_exchange_strong(&c->addr, &addr1, kLocked, atomic_compare_exchange_strong(&c->addr, &addr1, kLocked,