1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
6 void *Thread1(void *x
) {
8 barrier_wait(&barrier
);
12 void *Thread2(void *x
) {
13 barrier_wait(&barrier
);
20 barrier_init(&barrier
, 2);
23 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
24 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
25 pthread_join(t
[0], NULL
);
26 pthread_join(t
[1], NULL
);
29 // CHECK: WARNING: ThreadSanitizer: data race
30 // CHECK: Write of size 8
33 // CHECK: Previous read of size 8