8 if (sem_init(&id, 0, 1) < 0) {
13 /* This should succeed right away and set the value to 0. */
14 if (timedwait(&id, 5000, &elapsed, 0) < 0) {
18 if (!ELAPSED(elapsed, 0)) {
19 fprintf(stderr, "sem_timedwait() of unlocked sem took %ums",
24 if (checkvalue(&id, 0) < 0) {
29 if (sem_destroy(&id) < 0) {
30 perror("sem_destroy");