1 // RUN: %clangxx_tsan %linux_static_libstdcplusplus -O1 %s -o %t && %run %t 2>&1 \
15 void *AsyncInit(void *p) {
16 return new Cache((int)(long)p);
19 Cache *CreateCache() {
21 pthread_create(&t, 0, AsyncInit, (void*)(long)rand());
23 pthread_join(t, &res);
27 void *Thread1(void *x) {
28 static Cache *c = CreateCache();
36 pthread_create(&t[0], 0, Thread1, 0);
37 pthread_create(&t[1], 0, Thread1, 0);
38 pthread_join(t[0], 0);
39 pthread_join(t[1], 0);
40 fprintf(stderr, "PASS\n");
43 // CHECK-NOT: WARNING: ThreadSanitizer: data race