diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2012-11-07 15:08:20 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2012-11-07 15:08:20 +0000 |
commit | 538f1ba8cb57cfa02d25f8f922feb00975e0a286 (patch) | |
tree | 55b72069671822e191d3a3f2190dd285c3329fae /lib/tsan/rtl/tsan_rtl_mutex.cc | |
parent | 6b641c5e63be45a03f96346886d27c4b4135ddaf (diff) |
tsan: more precise handling of finalizers
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@167530 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_rtl_mutex.cc')
-rw-r--r-- | lib/tsan/rtl/tsan_rtl_mutex.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/tsan/rtl/tsan_rtl_mutex.cc b/lib/tsan/rtl/tsan_rtl_mutex.cc index a2e568153..0a756683c 100644 --- a/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -231,6 +231,20 @@ void Acquire(ThreadState *thr, uptr pc, uptr addr) { s->mtx.ReadUnlock(); } +void AcquireGlobal(ThreadState *thr, uptr pc) { + Context *ctx = CTX(); + Lock l(&ctx->thread_mtx); + for (unsigned i = 0; i < kMaxTid; i++) { + ThreadContext *tctx = ctx->threads[i]; + if (tctx == 0) + continue; + if (tctx->status == ThreadStatusRunning) + thr->clock.set(i, tctx->thr->fast_state.epoch()); + else + thr->clock.set(i, tctx->epoch1); + } +} + void Release(ThreadState *thr, uptr pc, uptr addr) { CHECK_GT(thr->in_rtl, 0); DPrintf("#%d: Release %zx\n", thr->tid, addr); |