Skip to content

Commit b3267bb

Browse files
committed
[NFC][msan] Split ThreadStart and Init
1 parent d61eb6c commit b3267bb

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

compiler-rt/lib/msan/msan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ void __msan_init() {
470470

471471
MsanThread *main_thread = MsanThread::Create(nullptr, nullptr);
472472
SetCurrentThread(main_thread);
473-
main_thread->ThreadStart();
473+
main_thread->Init();
474474

475475
#if MSAN_CONTAINS_UBSAN
476476
__ubsan::InitAsPlugin();

compiler-rt/lib/msan/msan_interceptors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ extern "C" int pthread_attr_destroy(void *attr);
10331033
static void *MsanThreadStartFunc(void *arg) {
10341034
MsanThread *t = (MsanThread *)arg;
10351035
SetCurrentThread(t);
1036+
t->Init();
10361037
return t->ThreadStart();
10371038
}
10381039

compiler-rt/lib/msan/msan_thread.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,7 @@ void MsanThread::Destroy() {
6565
DTLS_Destroy();
6666
}
6767

68-
thread_return_t MsanThread::ThreadStart() {
69-
Init();
70-
71-
if (!start_routine_) {
72-
// start_routine_ == 0 if we're on the main thread or on one of the
73-
// OS X libdispatch worker threads. But nobody is supposed to call
74-
// ThreadStart() for the worker threads.
75-
return 0;
76-
}
77-
78-
thread_return_t res = start_routine_(arg_);
79-
80-
return res;
81-
}
68+
thread_return_t MsanThread::ThreadStart() { return start_routine_(arg_); }
8269

8370
MsanThread::StackBounds MsanThread::GetStackBounds() const {
8471
if (!stack_switching_)

0 commit comments

Comments
 (0)