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
drd/tests/std_thread2: Make this test independent of the libstdc++ version
[valgrind.git]
/
none
/
tests
/
pth_mutexspeed.c
blob
ad263e193dadcc7d2f4f768f2eca1b3239c6d356
1
2
#include <stdio.h>
3
#include <assert.h>
4
#include <pthread.h>
5
6
int
main
(
void
)
7
{
8
const int
n
=
100000
;
9
int
i
,
r
;
10
pthread_mutex_t mx
=
PTHREAD_MUTEX_INITIALIZER
;
11
printf
(
"begin %d lock--unlocks
\n
"
,
n
);
12
for
(
i
=
0
;
i
<
n
;
i
++) {
13
r
=
pthread_mutex_lock
(&
mx
);
14
r
|=
pthread_mutex_unlock
(&
mx
);
15
assert
(
r
==
0
);
16
}
17
printf
(
"done %d lock--unlocks
\n
"
,
n
);
18
return
0
;
19
}