summaryrefslogtreecommitdiff
path: root/libsanitizer/sanitizer_common/sanitizer_thread_registry.cc
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2016-11-09 16:58:17 +0300
committerAlexander Monakov <amonakov@ispras.ru>2016-11-09 16:58:17 +0300
commit333610c1ceadf0febb112e8f9a3f405d25a0345a (patch)
tree29ee0b1fc30f8a28e916e1c06f982933a73f4f2b /libsanitizer/sanitizer_common/sanitizer_thread_registry.cc
parent16ca0e4e4bc093bfb2c08b167ce1f2116e37758b (diff)
parent421721dfaaddd54b376a5ac48e15ce6c7704bde3 (diff)
downloadgcc-333610c1ceadf0febb112e8f9a3f405d25a0345a.tar.gz
Merge remote-tracking branch 'origin/trunk' into gomp-nvptx-branch-merge-trunkamonakov/gomp-nvptx
Diffstat (limited to 'libsanitizer/sanitizer_common/sanitizer_thread_registry.cc')
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_thread_registry.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/libsanitizer/sanitizer_common/sanitizer_thread_registry.cc b/libsanitizer/sanitizer_common/sanitizer_thread_registry.cc
index bfa610443c1..c865d2cad84 100644
--- a/libsanitizer/sanitizer_common/sanitizer_thread_registry.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_thread_registry.cc
@@ -129,7 +129,7 @@ u32 ThreadRegistry::CreateThread(uptr user_id, bool detached, u32 parent_tid,
tctx = context_factory_(tid);
threads_[tid] = tctx;
} else {
-#ifndef SANITIZER_GO
+#if !SANITIZER_GO
Report("%s: Thread limit (%u threads) exceeded. Dying.\n",
SanitizerToolName, max_threads_);
#else
@@ -275,6 +275,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;