llvm-project
19 строк · 447.0 Байт
1// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2#include "test.h"3
4void *Thread(void *x) {5barrier_wait(&barrier);6return 0;7}
8
9int main() {10barrier_init(&barrier, 2);11pthread_t t;12pthread_create(&t, 0, Thread, 0);13barrier_wait(&barrier);14sleep(1); // wait for the thread to finish and exit15return 0;16}
17
18// CHECK: WARNING: ThreadSanitizer: thread leak
19// CHECK: SUMMARY: ThreadSanitizer: thread leak{{.*}}main
20