1 // RUN: %clang_tsan -O1 %s -lpthread -o %t && %deflake %run %t | FileCheck %s
3 // https://github.com/google/sanitizers/issues/468
4 // When the data race was reported, pthread_atfork() handler used to be
5 // executed which caused another race report in the same thread, which resulted
11 void *worker(void *unused
) {
12 barrier_wait(&barrier
);
18 fprintf(stderr
, "ATFORK\n");
23 barrier_init(&barrier
, 2);
24 pthread_atfork(atfork
, atfork
, atfork
);
26 pthread_create(&t
, NULL
, worker
, NULL
);
28 barrier_wait(&barrier
);
29 pthread_join(t
, NULL
);
30 // CHECK: ThreadSanitizer: data race