1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
---|---|
2 | #include <pthread.h> |
3 | #include <stdio.h> |
4 | |
5 | void *Thread(void *x) { |
6 | return 0; |
7 | } |
8 | |
9 | int main() { |
10 | pthread_t t; |
11 | pthread_create(newthread: &t, attr: 0, start_routine: Thread, arg: 0); |
12 | pthread_detach(th: t); |
13 | fprintf(stderr, format: "PASS\n"); |
14 | return 0; |
15 | } |
16 | |
17 | // CHECK-NOT: WARNING: ThreadSanitizer: thread leak |
18 |