[NFC][LSAN] Fix flaky multithreaded test

This commit is contained in:
Vitaly Buka 2021-05-10 17:32:36 -07:00
parent 842b162446
commit c057779d38
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
// Number of threads to create. This value is greater than kMaxThreads in
// lsan_thread.cpp so that we can test that thread contexts are not being
@ -18,7 +19,7 @@ void *null_func(void *args) {
int main(void) {
for (size_t i = 0; i < kTestThreads; i++) {
pthread_t thread;
pthread_create(&thread, NULL, null_func, NULL);
if (pthread_create(&thread, NULL, null_func, NULL) == 0)
pthread_detach(thread);
}
return 0;