.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
-.TH SEM_WAIT 3 2017-03-13 "Linux" "Linux Programmer's Manual"
+.TH SEM_WAIT 3 2017-09-15 "Linux" "Linux Programmer's Manual"
.SH NAME
sem_wait, sem_timedwait, sem_trywait \- lock a semaphore
.SH SYNOPSIS
This structure is defined as follows:
.PP
.in +4n
-.nf
+.EX
struct timespec {
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds [0 .. 999999999] */
};
-.fi
+.EE
.in
.PP
If the timeout has already expired by the time of the call,
The following shows what happens on two different runs of the program:
.PP
.in +4n
-.nf
+.EX
.RB "$" " ./a.out 2 3"
About to call sem_timedwait()
sem_post() from handler
.RB "$" " ./a.out 2 1"
About to call sem_timedwait()
sem_timedwait() timed out
-.fi
+.EE
.in
.SS Program source
\&