1 // RUN: %clangxx_tsan -O1 %s -o %t && %env_tsan_opts=print_full_thread_history=true %deflake %run %t 2>&1 | FileCheck %s
7 void *Thread2(void *x
) {
8 barrier_wait(&barrier
);
13 void *Thread3(void *x
) {
15 barrier_wait(&barrier
);
19 void *Thread1(void *x
) {
21 pthread_create(&t
[0], NULL
, Thread2
, NULL
);
22 pthread_create(&t
[1], NULL
, Thread3
, NULL
);
23 pthread_join(t
[0], NULL
);
24 pthread_join(t
[1], NULL
);
29 barrier_init(&barrier
, 2);
31 pthread_create(&t
, NULL
, Thread1
, NULL
);
32 pthread_join(t
, NULL
);
36 // CHECK: WARNING: ThreadSanitizer: data race
37 // CHECK: Thread T2 {{.*}} created by thread T1 at
38 // CHECK: Thread T3 {{.*}} created by thread T1 at:
39 // CHECK: Thread T1 {{.*}} created by main thread at:
40 // CHECK: SUMMARY: ThreadSanitizer: data race{{.*}}