1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
4 // Test for https://llvm.org/bugs/show_bug.cgi?id=23235
5 // The bug was that synchronization between thread creation and thread start
6 // is not established if pthread_create is followed by pthread_detach.
10 void *Thread(void *a
) {
12 barrier_wait(&barrier
);
17 barrier_init(&barrier
, 2);
20 pthread_create(&t
, 0, Thread
, 0);
22 barrier_wait(&barrier
);
23 fprintf(stderr
, "PASS\n");
27 // CHECK-NOT: WARNING: ThreadSanitizer: data race