forked from OSchip/llvm-project
[sanitizer] Don't reuse the main thread in ThreadRegistry
There is a hard-to-reproduce crash happening on OS X that involves terminating the main thread (dispatch_main does that, see discussion at http://reviews.llvm.org/D18496) and later reusing the main thread's ThreadContext. This patch disables reuse of the main thread. I believe this problem exists only on OS X, because on other systems the main thread cannot be terminated without exiting the process. Differential Revision: http://reviews.llvm.org/D19722 llvm-svn: 268238
This commit is contained in:
parent
e5e04baf95
commit
d052a57900
|
@ -277,6 +277,8 @@ void ThreadRegistry::StartThread(u32 tid, uptr os_id, void *arg) {
|
|||
}
|
||||
|
||||
void ThreadRegistry::QuarantinePush(ThreadContextBase *tctx) {
|
||||
if (tctx->tid == 0)
|
||||
return; // Don't reuse the main thread. It's a special snowflake.
|
||||
dead_threads_.push_back(tctx);
|
||||
if (dead_threads_.size() <= thread_quarantine_size_)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue