[hwasan] fix pthread_exit

llvm-svn: 341594
This commit is contained in:
Kostya Serebryany 2018-09-06 22:13:43 +00:00
parent fe83270ee9
commit f1f556c179
2 changed files with 6 additions and 1 deletions

View File

@ -44,7 +44,7 @@ void Thread::InsertIntoThreadList(Thread *t) {
}
void Thread::RemoveFromThreadList(Thread *t) {
CHECK_NE(t, main_thread);
if (t == main_thread) return; // Do nothing (happens due to pthread_exit).
SpinMutexLock l(&thread_list_mutex);
thread_stats.n_live_threads--;
thread_stats.total_stack_size -= t->stack_size();

View File

@ -0,0 +1,5 @@
// Tests pthread_exit.
// RUN: %clang_hwasan %s -o %t && %run %t
// REQUIRES: stable-runtime
#include <pthread.h>
int main() { pthread_exit(NULL); }