diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-05-29 13:50:54 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-05-29 13:50:54 +0000 |
commit | ef0f7ccc94812900a1426fb04979a7779b75db45 (patch) | |
tree | b4180cb99c6490cf179cbfd94f91400575af677d /test/tsan/mutexset7.cc | |
parent | dbb3f375dc7377890be4db8f6870a7a53a130a5a (diff) |
tsan: refactor storage of meta information for heap blocks and sync objects
The new storage (MetaMap) is based on direct shadow (instead of a hashmap + per-block lists).
This solves a number of problems:
- eliminates quadratic behaviour in SyncTab::GetAndLock (https://code.google.com/p/thread-sanitizer/issues/detail?id=26)
- eliminates contention in SyncTab
- eliminates contention in internal allocator during allocation of sync objects
- removes a bunch of ad-hoc code in java interface
- reduces java shadow from 2x to 1/2x
- allows to memorize heap block meta info for Java and Go
- allows to cleanup sync object meta info for Go
- which in turn enabled deadlock detector for Go
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209810 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/mutexset7.cc')
-rw-r--r-- | test/tsan/mutexset7.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/tsan/mutexset7.cc b/test/tsan/mutexset7.cc index a8a907a88..b80eddb08 100644 --- a/test/tsan/mutexset7.cc +++ b/test/tsan/mutexset7.cc @@ -13,12 +13,13 @@ void *Thread1(void *x) { } void *Thread2(void *x) { - pthread_mutex_t mtx; - pthread_mutex_init(&mtx, 0); - pthread_mutex_lock(&mtx); + pthread_mutex_t *mtx = new pthread_mutex_t; + pthread_mutex_init(mtx, 0); + pthread_mutex_lock(mtx); Global--; - pthread_mutex_unlock(&mtx); - pthread_mutex_destroy(&mtx); + pthread_mutex_unlock(mtx); + pthread_mutex_destroy(mtx); + delete mtx; return NULL; } |