[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / tsan / simple_race.c
blob78f105fa17450307ee26d105a2b7964dc40b105d
1 // RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <unistd.h>
6 int Global;
8 void *Thread1(void *x) {
9 sleep(1);
10 Global = 42;
11 return NULL;
14 void *Thread2(void *x) {
15 Global = 43;
16 return NULL;
19 int main() {
20 pthread_t t[2];
21 pthread_create(&t[0], NULL, Thread1, NULL);
22 pthread_create(&t[1], NULL, Thread2, NULL);
23 pthread_join(t[0], NULL);
24 pthread_join(t[1], NULL);
25 return 0;
28 // CHECK: WARNING: ThreadSanitizer: data race