2014-05-30 22:08:51 +08:00
|
|
|
// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
|
2015-01-21 21:50:02 +08:00
|
|
|
#include "test.h"
|
2012-05-10 22:18:22 +08:00
|
|
|
|
|
|
|
void *Thread(void *x) {
|
2015-01-21 21:50:02 +08:00
|
|
|
barrier_wait(&barrier);
|
2012-05-10 22:18:22 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
2015-01-21 21:50:02 +08:00
|
|
|
barrier_init(&barrier, 2);
|
2012-05-10 22:18:22 +08:00
|
|
|
pthread_t t;
|
|
|
|
pthread_create(&t, 0, Thread, 0);
|
2015-01-21 21:50:02 +08:00
|
|
|
barrier_wait(&barrier);
|
|
|
|
sleep(1); // wait for the thread to finish and exit
|
2012-05-10 22:18:22 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: WARNING: ThreadSanitizer: thread leak
|
2013-02-06 22:24:00 +08:00
|
|
|
// CHECK: SUMMARY: ThreadSanitizer: thread leak{{.*}}main
|