forked from OSchip/llvm-project
[Tsan] Make calloc() to not track allocated space unless thread is completely initialized
Differential Revision: http://reviews.llvm.org/D5992 llvm-svn: 220673
This commit is contained in:
parent
a58fed9ab7
commit
9deb007191
|
@ -872,11 +872,13 @@ extern "C" void *__tsan_thread_start_func(void *arg) {
|
||||||
ThreadState *thr = cur_thread();
|
ThreadState *thr = cur_thread();
|
||||||
// Thread-local state is not initialized yet.
|
// Thread-local state is not initialized yet.
|
||||||
ScopedIgnoreInterceptors ignore;
|
ScopedIgnoreInterceptors ignore;
|
||||||
|
ThreadIgnoreBegin(thr, 0);
|
||||||
if (pthread_setspecific(g_thread_finalize_key,
|
if (pthread_setspecific(g_thread_finalize_key,
|
||||||
(void *)kPthreadDestructorIterations)) {
|
(void *)kPthreadDestructorIterations)) {
|
||||||
Printf("ThreadSanitizer: failed to set thread key\n");
|
Printf("ThreadSanitizer: failed to set thread key\n");
|
||||||
Die();
|
Die();
|
||||||
}
|
}
|
||||||
|
ThreadIgnoreEnd(thr, 0);
|
||||||
while ((tid = atomic_load(&p->tid, memory_order_acquire)) == 0)
|
while ((tid = atomic_load(&p->tid, memory_order_acquire)) == 0)
|
||||||
pthread_yield();
|
pthread_yield();
|
||||||
atomic_store(&p->tid, 0, memory_order_release);
|
atomic_store(&p->tid, 0, memory_order_release);
|
||||||
|
|
Loading…
Reference in New Issue