1 // RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
11 void *Thread1(void *x
) {
13 int f
= open("/dev/random", O_RDONLY
);
21 void *Thread2(void *x
) {
23 write(STDOUT_FILENO
, "a", 1);
29 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
30 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
31 pthread_join(t
[0], NULL
);
32 pthread_join(t
[1], NULL
);
35 // CHECK: WARNING: ThreadSanitizer: data race
36 // CHECK: Write of size 4
38 // CHECK: Previous write of size 4