1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 #include "test.h" 3 4 int X = 0; 5 Thread(void * p)6void *Thread(void *p) { 7 X = 42; 8 barrier_wait(&barrier); 9 return 0; 10 } 11 main()12int main() { 13 barrier_init(&barrier, 2); 14 pthread_t t; 15 sleep(1); // must not appear in the report 16 pthread_create(&t, 0, Thread, 0); 17 barrier_wait(&barrier); 18 X = 43; 19 pthread_join(t, 0); 20 return 0; 21 } 22 23 // CHECK: WARNING: ThreadSanitizer: data race 24 // CHECK-NOT: As if synchronized via sleep 25