1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
4 void *Thread(void *x
) {
5 barrier_wait(&barrier
);
10 volatile int N
= 5; // prevent loop unrolling
11 barrier_init(&barrier
, N
+ 1);
12 for (int i
= 0; i
< N
; i
++) {
14 pthread_create(&t
, 0, Thread
, 0);
16 barrier_wait(&barrier
);
17 sleep(1); // wait for the threads to finish and exit
21 // CHECK: WARNING: ThreadSanitizer: thread leak
22 // CHECK: And 4 more similar thread leaks