[llvm-commits] [compiler-rt] r154091 - in /compiler-rt/trunk/lib/asan: asan_thread_registry.cc asan_thread_registry.h
Alexander Potapenko
glider at google.com
Thu Apr 5 03:10:57 PDT 2012
Author: glider
Date: Thu Apr 5 05:10:57 2012
New Revision: 154091
URL: http://llvm.org/viewvc/llvm-project?rev=154091&view=rev
Log:
Allow calling GetCurrentTidOrMinusOne() before AsanThreadRegistry was initialized.
Modified:
compiler-rt/trunk/lib/asan/asan_thread_registry.cc
compiler-rt/trunk/lib/asan/asan_thread_registry.h
Modified: compiler-rt/trunk/lib/asan/asan_thread_registry.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread_registry.cc?rev=154091&r1=154090&r2=154091&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread_registry.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread_registry.cc Thu Apr 5 05:10:57 2012
@@ -37,6 +37,8 @@
main_thread_summary_.set_thread(&main_thread_);
RegisterThread(&main_thread_);
SetCurrent(&main_thread_);
+ // At this point only one thread exists.
+ inited_ = true;
}
void AsanThreadRegistry::RegisterThread(AsanThread *thread) {
Modified: compiler-rt/trunk/lib/asan/asan_thread_registry.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread_registry.h?rev=154091&r1=154090&r2=154091&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread_registry.h (original)
+++ compiler-rt/trunk/lib/asan/asan_thread_registry.h Thu Apr 5 05:10:57 2012
@@ -39,6 +39,7 @@
void SetCurrent(AsanThread *t);
int GetCurrentTidOrMinusOne() {
+ if (!inited_) return 0;
AsanThread *t = GetCurrent();
return t ? t->tid() : -1;
}
@@ -69,6 +70,7 @@
AsanStats accumulated_stats_;
int n_threads_;
AsanLock mu_;
+ bool inited_;
};
// Returns a single instance of registry.
More information about the llvm-commits
mailing list