1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
6 void *Thread(void *a
) {
8 while ((p
= __atomic_load_n(&g
, __ATOMIC_RELAXED
)) == 0)
9 usleep(100); // spin-wait
16 pthread_create(&t
, 0, Thread
, 0);
17 AnnotateIgnoreWritesBegin(__FILE__
, __LINE__
);
19 AnnotateIgnoreWritesEnd(__FILE__
, __LINE__
);
20 __atomic_store_n(&g
, p
, __ATOMIC_RELAXED
);
23 fprintf(stderr
, "OK\n");
27 // CHECK-NOT: WARNING: ThreadSanitizer: data race