1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
3 // pthread barriers are not available on OS X
14 void *Thread1(void *x
) {
15 if (pthread_barrier_wait(&B
) == PTHREAD_BARRIER_SERIAL_THREAD
)
16 pthread_barrier_destroy(&B
);
20 void *Thread2(void *x
) {
21 if (pthread_barrier_wait(&B
) == PTHREAD_BARRIER_SERIAL_THREAD
)
22 pthread_barrier_destroy(&B
);
27 pthread_barrier_init(&B
, 0, 2);
29 pthread_create(&t
, NULL
, Thread1
, NULL
);
31 pthread_join(t
, NULL
);
35 // CHECK: WARNING: ThreadSanitizer: data race