1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
4 void *Thread(void *x
) {
5 pthread_mutex_lock((pthread_mutex_t
*)x
);
6 pthread_mutex_unlock((pthread_mutex_t
*)x
);
7 barrier_wait(&barrier
);
12 barrier_init(&barrier
, 2);
14 pthread_mutex_init(&Mtx
, 0);
16 pthread_create(&t
, 0, Thread
, &Mtx
);
17 barrier_wait(&barrier
);
18 pthread_mutex_destroy(&Mtx
);
23 // CHECK: WARNING: ThreadSanitizer: data race