2014-08-06 02:45:02 +08:00
|
|
|
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
|
2015-01-21 21:50:02 +08:00
|
|
|
#include "test.h"
|
2014-08-06 02:45:02 +08:00
|
|
|
|
|
|
|
void *Thread(void *x) {
|
2015-01-21 21:50:02 +08:00
|
|
|
barrier_wait(&barrier);
|
2014-08-06 02:45:02 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
2015-01-21 21:50:02 +08:00
|
|
|
barrier_init(&barrier, 2);
|
2014-08-06 02:45:02 +08:00
|
|
|
pthread_t t;
|
|
|
|
pthread_create(&t, 0, Thread, 0);
|
2015-01-21 21:50:02 +08:00
|
|
|
barrier_wait(&barrier);
|
2014-08-06 02:45:02 +08:00
|
|
|
pthread_detach(t);
|
2016-04-15 20:34:00 +08:00
|
|
|
fprintf(stderr, "PASS\n");
|
2014-08-06 02:45:02 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-NOT: WARNING: ThreadSanitizer: thread leak
|
|
|
|
// CHECK: PASS
|