1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
13 Cache *CreateCache() {
18 _Atomic(Cache*) queue;
20 void *Thread1(void *x) {
21 static Cache *c = CreateCache();
22 __c11_atomic_store(&queue, c, 0);
26 void *Thread2(void *x) {
29 c = __c11_atomic_load(&queue, 0);
41 pthread_create(&t[0], 0, Thread1, 0);
42 pthread_create(&t[1], 0, Thread2, 0);
43 pthread_join(t[0], 0);
44 pthread_join(t[1], 0);
47 // CHECK: WARNING: ThreadSanitizer: data race