repo.or.cz
/
blocksruntime.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git]
/
test
/
tsan
/
tiny_race.c
blob
9d84224809072b6694e82d1243ea974fc59b31ba
1
// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
#include <pthread.h>
3
#include <unistd.h>
4
5
int
Global
;
6
7
void
*
Thread1
(
void
*
x
) {
8
sleep
(
1
);
9
Global
=
42
;
10
return
x
;
11
}
12
13
int
main
() {
14
pthread_t t
;
15
pthread_create
(&
t
,
0
,
Thread1
,
0
);
16
Global
=
43
;
17
pthread_join
(
t
,
0
);
18
return
Global
;
19
}
20
21
// CHECK: WARNING: ThreadSanitizer: data race