summaryrefslogtreecommitdiff
path: root/lib/asan/asan_thread_registry.h
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2012-04-05 10:10:57 +0000
committerAlexander Potapenko <glider@google.com>2012-04-05 10:10:57 +0000
commitadf331e82ff0f02f68eb3aabd94f9bbd46f94dd0 (patch)
tree64cefea67e8e716be93be5c1f60fb7cef923166d /lib/asan/asan_thread_registry.h
parentd51e0a05b4aefc85c356c9bddd8a24efc77721d9 (diff)
downloadcompiler-rt-adf331e82ff0f02f68eb3aabd94f9bbd46f94dd0.tar.gz
Allow calling GetCurrentTidOrMinusOne() before AsanThreadRegistry was initialized.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@154091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_thread_registry.h')
-rw-r--r--lib/asan/asan_thread_registry.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/asan/asan_thread_registry.h b/lib/asan/asan_thread_registry.h
index b011c2938..491101e74 100644
--- a/lib/asan/asan_thread_registry.h
+++ b/lib/asan/asan_thread_registry.h
@@ -39,6 +39,7 @@ class AsanThreadRegistry {
void SetCurrent(AsanThread *t);
int GetCurrentTidOrMinusOne() {
+ if (!inited_) return 0;
AsanThread *t = GetCurrent();
return t ? t->tid() : -1;
}
@@ -69,6 +70,7 @@ class AsanThreadRegistry {
AsanStats accumulated_stats_;
int n_threads_;
AsanLock mu_;
+ bool inited_;
};
// Returns a single instance of registry.