repo.or.cz
/
valgrind.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Add DRD suppression patterns for races triggered by std::ostream
[valgrind.git]
/
helgrind
/
tests
/
hg04_race.c
blob
111195bf903f8d6ba91194bfc8be60d7b12215e7
1
/* A simple race */
2
3
#include <pthread.h>
4
#include <unistd.h>
5
6
static int
shared
;
7
8
static void
*
th
(
void
*
v
)
9
{
10
shared
++;
11
12
return
0
;
13
}
14
15
int
main
()
16
{
17
pthread_t a
,
b
;
18
19
pthread_create
(&
a
,
NULL
,
th
,
NULL
);
20
sleep
(
1
);
/* force ordering */
21
pthread_create
(&
b
,
NULL
,
th
,
NULL
);
22
23
pthread_join
(
a
,
NULL
);
24
pthread_join
(
b
,
NULL
);
25
26
return
0
;
27
}