1 // RUN: %clangxx_tsan -O1 --std=c++11 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
2 #include "custom_mutex.h"
4 // Test that failed TryLock does not induce parasitic synchronization.
14 barrier_wait(&barrier
);
15 barrier_wait(&barrier
);
21 barrier_init(&barrier
, 2);
23 pthread_create(&th
, 0, thr
, 0);
24 barrier_wait(&barrier
);
26 fprintf(stderr
, "TryLock succeeded, should not\n");
30 barrier_wait(&barrier
);
32 fprintf(stderr
, "DONE\n");
36 // CHECK: ThreadSanitizer: data race
37 // CHECK-NEXT: Write of size 8 at {{.*}} by main thread:
38 // CHECK-NEXT: #0 main {{.*}}custom_mutex1.cpp:29