1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
3 // Test that pause loop handles signals.
9 void handler(int signum
) {
10 write(2, "DONE\n", 5);
14 void *thread(void *arg
) {
20 int main(int argc
, char** argv
) {
21 struct sigaction act
= {};
22 act
.sa_handler
= &handler
;
23 if (sigaction(SIGUSR1
, &act
, 0)) {
24 fprintf(stderr
, "sigaction failed %d\n", errno
);
28 pthread_create(&th
, 0, thread
, 0);
29 sleep(1); // give it time to block in pause
30 pthread_kill(th
, SIGUSR1
);
31 sleep(10); // signal handler must exit the process while we are here