1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
7 void *Thread(void *arg
) {
9 read((long)arg
, &buf
, 1);
10 barrier_wait(&barrier
);
15 barrier_init(&barrier
, 2);
16 int fd
= open("/dev/random", O_RDONLY
);
18 pthread_create(&t
, NULL
, Thread
, (void *)(long)fd
);
19 barrier_wait(&barrier
);
21 pthread_join(t
, NULL
);
22 fprintf(stderr
, "DONE\n");
25 // CHECK: WARNING: ThreadSanitizer: data race