1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
11 static void handler(int sig
) {
17 static void* thr(void *p
) {
18 for (int i
= 0; i
!= 1000; i
++)
19 usleep(1000); // process signals
24 const int kThreads
= 10;
25 pthread_t th
[kThreads
];
26 for (int i
= 0; i
< kThreads
; i
++)
27 pthread_create(&th
[i
], 0, thr
, 0);
31 struct sigaction act
= {};
32 act
.sa_handler
= &handler
;
33 if (sigaction(SIGPROF
, &act
, 0)) {
39 t
.it_value
.tv_sec
= 0;
40 t
.it_value
.tv_usec
= 10;
41 t
.it_interval
= t
.it_value
;
42 if (setitimer(ITIMER_PROF
, &t
, 0)) {
47 for (int i
= 0; i
< kThreads
; i
++)
48 pthread_join(th
[i
], 0);
50 fprintf(stderr
, "DONE\n");
54 // CHECK-NOT: WARNING: ThreadSanitizer:
56 // CHECK-NOT: WARNING: ThreadSanitizer: