diff options
Diffstat (limited to 'compiler-rt/test/tsan/thread_detach.c')
-rw-r--r-- | compiler-rt/test/tsan/thread_detach.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler-rt/test/tsan/thread_detach.c b/compiler-rt/test/tsan/thread_detach.c new file mode 100644 index 00000000000..32cf641b141 --- /dev/null +++ b/compiler-rt/test/tsan/thread_detach.c @@ -0,0 +1,20 @@ +// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> + +void *Thread(void *x) { + return 0; +} + +int main() { + pthread_t t; + pthread_create(&t, 0, Thread, 0); + sleep(1); + pthread_detach(t); + printf("PASS\n"); + return 0; +} + +// CHECK-NOT: WARNING: ThreadSanitizer: thread leak +// CHECK: PASS |