1 // RUN: %clangxx_tsan %s -o %t && %run %t 2>&1 | FileCheck %s
4 // It's very flaky on PPC with COMPILER_RT_DEBUG.
5 // UNSUPPORTED: !compiler-rt-optimized && ppc
7 // Test case for https://github.com/google/sanitizers/issues/1540
15 #include <sys/types.h>
20 static void handler(int sig
) {
26 static void *thr1(void *p
) {
31 static void *thr(void *p
) {
33 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
34 pthread_create(&th
[i
], 0, thr1
, 0);
35 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
36 pthread_join(th
[i
], 0);
41 struct sigaction act
= {};
42 act
.sa_handler
= &handler
;
43 if (sigaction(SIGPROF
, &act
, 0)) {
49 t
.it_value
.tv_sec
= 0;
50 t
.it_value
.tv_usec
= 10;
51 t
.it_interval
= t
.it_value
;
52 if (setitimer(ITIMER_PROF
, &t
, 0)) {
58 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
59 pthread_create(&th
[i
], 0, thr
, 0);
60 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
61 pthread_join(th
[i
], 0);
63 fprintf(stderr
, "DONE\n");
67 // CHECK-NOT: WARNING: ThreadSanitizer:
69 // CHECK-NOT: WARNING: ThreadSanitizer: