1 | // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s |
2 | #include <pthread.h> |
3 | #include <unistd.h> |
4 | |
5 | int main() { |
6 | pthread_mutex_t m; |
7 | pthread_mutex_init(mutex: &m, mutexattr: 0); |
8 | pthread_mutex_lock(mutex: &m); |
9 | pthread_mutex_destroy(mutex: &m); |
10 | return 0; |
11 | } |
12 | |
13 | // CHECK: WARNING: ThreadSanitizer: destroy of a locked mutex |
14 | // CHECK: #0 pthread_mutex_destroy |
15 | // CHECK: #1 main |
16 | // CHECK: and: |
17 | // CHECK: #0 pthread_mutex_lock |
18 | // CHECK: #1 main |
19 | // CHECK: Mutex {{.*}} created at: |
20 | // CHECK: #0 pthread_mutex_init |
21 | // CHECK: #1 main |
22 | // CHECK: SUMMARY: ThreadSanitizer: destroy of a locked mutex{{.*}}main |
23 | |