1 /* { dg-shouldfail "tsan" } */
2 /* { dg-additional-options "-ldl" } */
6 #include "tsan_barrier.h"
8 static pthread_barrier_t barrier
;
15 void *Thread(void *p
) {
16 barrier_wait(&barrier
);
17 MySleep(); // Assume the main thread has done the write.
23 barrier_init(&barrier
, 2);
25 pthread_create(&t
, 0, Thread
, 0);
27 barrier_wait(&barrier
);
32 /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r).*} */
33 /* { dg-output " As if synchronized via sleep:(\n|\r\n|\r)} */
34 /* { dg-output " #0 sleep.*"*} */
35 /* { dg-output " #1 MySleep.*"*} */
36 /* { dg-output " #2 Thread.*"*} */