1 // RUN: %clangxx_tsan -O1 %s -o %t && %env_tsan_opts=atexit_sleep_ms=50 %run %t 2>&1 | FileCheck %s
9 static void *incrementer(void *p
) {
11 __sync_fetch_and_add(&counter
, 1);
16 barrier_init(&barrier
, 2);
18 pthread_create(&th1
, 0, incrementer
, 0);
19 for (int i
= 0; i
< 10; i
++) {
22 while (wait(0) < 0) {}
26 __sync_fetch_and_add(&counter
, 1);
30 fprintf(stderr
, "failed to fork (%d)\n", errno
);
34 fprintf(stderr
, "OK\n");