1 // RUN: %clangxx_tsan -O1 %s -o %t && %env_tsan_opts=atexit_sleep_ms=50 %run %t 2>&1 | FileCheck %s
10 static void *incrementer(void *p
) {
12 __sync_fetch_and_add(&counter
, 1);
18 pthread_create(&th1
, 0, incrementer
, 0);
19 for (int i
= 0; i
< 10; i
++) {
27 __sync_fetch_and_add(&counter
, 1);
31 fprintf(stderr
, "failed to fork (%d)\n", errno
);
35 fprintf(stderr
, "OK\n");