1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
11 void *Thread1(void *x
) {
13 read(fds
[0], &buf
, 1);
18 void *Thread2(void *x
) {
24 fds
[0] = open("/dev/random", O_RDONLY
);
25 fds
[1] = dup2(fds
[0], 100);
27 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
28 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
29 pthread_join(t
[0], NULL
);
30 pthread_join(t
[1], NULL
);
31 fprintf(stderr
, "OK\n");
34 // CHECK-NOT: WARNING: ThreadSanitizer: data race