1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
10 void *Thread1(void *x
) {
12 barrier_wait(&barrier
);
16 void *Thread2(void *x
) {
22 barrier_init(&barrier
, 2);
23 fd
= open("/dev/null", O_WRONLY
);
26 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
27 barrier_wait(&barrier
);
28 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
29 pthread_join(t
[0], NULL
);
30 pthread_join(t
[1], NULL
);
34 // CHECK: WARNING: ThreadSanitizer: data race
35 // CHECK: Read of size 1
37 // CHECK: Previous write of size 1