1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
7 void *Thread1(void *x
) {
8 int f
= open("/dev/random", O_RDONLY
);
10 barrier_wait(&barrier
);
14 void *Thread2(void *x
) {
15 barrier_wait(&barrier
);
16 int f
= open("/dev/random", O_RDONLY
);
22 barrier_init(&barrier
, 2);
24 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
25 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
26 pthread_join(t
[0], NULL
);
27 pthread_join(t
[1], NULL
);
28 fprintf(stderr
, "OK\n");
31 // CHECK-NOT: WARNING: ThreadSanitizer: data race