1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
6 #include <sys/socket.h>
11 void *Thread1(void *x
) {
13 write(fds
[1], "a", 1);
18 void *Thread2(void *x
) {
20 while (read(fds
[0], &buf
, 1) != 1) {
28 socketpair(AF_UNIX
, SOCK_STREAM
, 0, fds
);
30 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
31 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
32 pthread_join(t
[0], NULL
);
33 pthread_join(t
[1], NULL
);
34 fprintf(stderr
, "OK\n");
37 // CHECK-NOT: WARNING: ThreadSanitizer: data race