nant's projects
/
dragonfly.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
netinet{,6}: Assert in{,6}_inithead() are only used for system routing tables.
[dragonfly.git]
/
test
/
testcases
/
posixipc
/
trywait_unlocked
/
trywait_unlocked.c
1
#include <common.h>
2
3
int
4
main(void) {
5
sem_t id;
6
7
if (sem_init(&id, 0, 1) < 0) {
8
perror("sem_init");
9
return 1;
10
}
11
12
/* This should succeed and decrement the value to 0. */
13
if (sem_trywait(&id) < 0) {
14
perror("sem_trywait()");
15
sem_destroy(&id);
16
return 1;
17
}
18
if (checkvalue(&id, 0) < 0) {
19
sem_destroy(&id);
20
return 1;
21
}
22
23
if (sem_destroy(&id) < 0) {
24
perror("sem_destroy");
25
return 1;
26
}
27
return 0;
28
}