forked from OSchip/llvm-project
[NFC][LSAN] Fix flaky multithreaded test
This commit is contained in:
parent
842b162446
commit
c057779d38
|
@ -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,8 +19,8 @@ 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);
|
||||
pthread_detach(thread);
|
||||
if (pthread_create(&thread, NULL, null_func, NULL) == 0)
|
||||
pthread_detach(thread);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue