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
[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git]
/
test
/
tsan
/
sleep_sync2.cc
blob
e22999279f9fa85bed85d9063deb37aad4426182
1
// RUN: %clangxx_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
2
#include <pthread.h>
3
#include <unistd.h>
4
5
int
X
=
0
;
6
7
void
*
Thread
(
void
*
p
) {
8
X
=
42
;
9
return
0
;
10
}
11
12
int
main
() {
13
pthread_t t
;
14
sleep
(
1
);
15
pthread_create
(&
t
,
0
,
Thread
,
0
);
16
X
=
43
;
17
pthread_join
(
t
,
0
);
18
return
0
;
19
}
20
21
// CHECK: WARNING: ThreadSanitizer: data race
22
// CHECK-NOT: As if synchronized via sleep