summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-04-28 09:26:30 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-04-28 09:26:30 +0000
commitdc7b607b09460ba85890c2c4af0f7ee43c2bc4cd (patch)
tree8777a4544042230c265c02b349fd0bd2801755b2 /compiler-rt/lib/tsan
parent24b5baed27af978155aea32b6a612a0b3ca8fc19 (diff)
downloadbcm5719-llvm-dc7b607b09460ba85890c2c4af0f7ee43c2bc4cd.tar.gz
bcm5719-llvm-dc7b607b09460ba85890c2c4af0f7ee43c2bc4cd.zip
[tsan] Fix Darwin GCD support after separation of Processor and ThreadState
Recent TSan changes (r267678) which factor out parts of ThreadState into a Processor structure broke worker threads on OS X. This fixes it by properly calling ProcCreate for GCD worker threads and by replacing some CHECKs with RAW_CHECK in early process initialization. CHECK() in TSan calls the allocator, which requires a valid Processor. llvm-svn: 267864
Diffstat (limited to 'compiler-rt/lib/tsan')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc
index 6109ef28b33..7a906d524a9 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc
@@ -135,10 +135,12 @@ static void my_pthread_introspection_hook(unsigned int event, pthread_t thread,
if (event == PTHREAD_INTROSPECTION_THREAD_CREATE) {
if (thread == pthread_self()) {
// The current thread is a newly created GCD worker thread.
+ ThreadState *thr = cur_thread();
+ Processor *proc = ProcCreate();
+ ProcWire(proc, thr);
ThreadState *parent_thread_state = nullptr; // No parent.
int tid = ThreadCreate(parent_thread_state, 0, (uptr)thread, true);
CHECK_NE(tid, 0);
- ThreadState *thr = cur_thread();
ThreadStart(thr, tid, GetTid());
}
} else if (event == PTHREAD_INTROSPECTION_THREAD_TERMINATE) {
OpenPOWER on IntegriCloud