1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
---|---|
2 | #include "test.h" |
3 | |
4 | void *Thread(void *x) { |
5 | barrier_wait(barrier: &barrier); |
6 | return 0; |
7 | } |
8 | |
9 | int main() { |
10 | barrier_init(barrier: &barrier, count: 2); |
11 | pthread_t t; |
12 | pthread_create(newthread: &t, attr: 0, start_routine: Thread, arg: 0); |
13 | barrier_wait(barrier: &barrier); |
14 | pthread_detach(th: t); |
15 | fprintf(stderr, format: "PASS\n"); |
16 | return 0; |
17 | } |
18 | |
19 | // CHECK-NOT: WARNING: ThreadSanitizer: thread leak |
20 | // CHECK: PASS |
21 |