1 // Test that Thread objects are reused.
2 // RUN: %clangxx_hwasan -mllvm -hwasan-globals=0 -mllvm -hwasan-instrument-stack=0 %s -o %t && %env_hwasan_opts=verbose_threads=1 %run %t 2>&1 | FileCheck %s
11 #include <sanitizer/hwasan_interface.h>
13 pthread_barrier_t bar
;
15 void *threadfn(void *) {
16 pthread_barrier_wait(&bar
);
20 void start_stop_threads() {
24 pthread_barrier_init(&bar
, nullptr, N
+ 1);
25 for (auto &t
: threads
)
26 pthread_create(&t
, nullptr, threadfn
, nullptr);
28 pthread_barrier_wait(&bar
);
30 for (auto &t
: threads
)
31 pthread_join(t
, nullptr);
32 pthread_barrier_destroy(&bar
);
36 // Cut off initial threads.
37 // CHECK: === test start ===
38 fprintf(stderr
, "=== test start ===\n");
40 // CHECK: Creating : T{{[0-9]+}} [[A:0x[0-9a-f]+]] stack:
41 // CHECK: Creating : T{{[0-9]+}} [[B:0x[0-9a-f]+]] stack:
44 // CHECK-DAG: Creating : T{{[0-9]+}} [[A]] stack:
45 // CHECK-DAG: Creating : T{{[0-9]+}} [[B]] stack:
48 // CHECK-DAG: Creating : T{{[0-9]+}} [[A]] stack:
49 // CHECK-DAG: Creating : T{{[0-9]+}} [[B]] stack: