1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
6 __attribute__((noinline
)) void MySleep() {
7 sleep(1); // the sleep that must appear in the report
10 void *Thread(void *p
) {
11 barrier_wait(&barrier
);
12 MySleep(); // Assume the main thread has done the write.
18 barrier_init(&barrier
, 2);
20 pthread_create(&t
, 0, Thread
, 0);
22 barrier_wait(&barrier
);
27 // CHECK: WARNING: ThreadSanitizer: data race
29 // CHECK: As if synchronized via sleep:
30 // CHECK-NEXT: #0 sleep
31 // CHECK-NEXT: #1 MySleep
32 // CHECK-NEXT: #2 Thread