call ::pthread_detach on llvm_execute_on_thread_impl

Fixes all TSAN bugs in clangd

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D83039
This commit is contained in:
Nathan James 2020-07-02 14:41:03 +01:00
parent 23eeae5526
commit e0968ad459
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 4 additions and 0 deletions

View File

@ -94,6 +94,10 @@ llvm_execute_on_thread_impl(void *(*ThreadFunc)(void *), void *Arg,
if ((errnum = ::pthread_join(Thread, nullptr)) != 0) {
ReportErrnumFatal("pthread_join failed", errnum);
}
} else if (JP == JoiningPolicy::Detach) {
if ((errnum = ::pthread_detach(Thread)) != 0) {
ReportErrnumFatal("pthread_detach failed", errnum);
}
}
}