summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libpthread/man/Makefile.inc3
-rw-r--r--lib/libpthread/man/sem_wait.337
2 files changed, 33 insertions, 7 deletions
diff --git a/lib/libpthread/man/Makefile.inc b/lib/libpthread/man/Makefile.inc
index 5dac0aa7d09..ba55564d62e 100644
--- a/lib/libpthread/man/Makefile.inc
+++ b/lib/libpthread/man/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.29 2012/02/24 06:37:33 guenther Exp $
+# $OpenBSD: Makefile.inc,v 1.30 2012/03/03 22:48:42 guenther Exp $
# $FreeBSD: Makefile.inc,v 1.6 1999/08/28 00:03:02 peter Exp $
# POSIX thread man files
@@ -112,5 +112,6 @@ MLINKS+=flockfile.3 funlockfile.3 \
sched_get_priority_min.3 sched_get_priority_max.3 \
sem_open.3 sem_close.3 \
sem_open.3 sem_unlink.3 \
+ sem_wait.3 sem_timedwait.3 \
sem_wait.3 sem_trywait.3
diff --git a/lib/libpthread/man/sem_wait.3 b/lib/libpthread/man/sem_wait.3
index e20978c628b..45a07a23f5b 100644
--- a/lib/libpthread/man/sem_wait.3
+++ b/lib/libpthread/man/sem_wait.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sem_wait.3,v 1.6 2007/05/31 19:19:37 jmc Exp $
+.\" $OpenBSD: sem_wait.3,v 1.7 2012/03/03 22:48:42 guenther Exp $
.\"
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
@@ -28,7 +28,7 @@
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/lib/libc_r/man/sem_wait.3,v 1.8 2001/10/01 16:09:09 ru Exp $
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: March 3 2012 $
.Dt SEM_WAIT 3
.Os
.Sh NAME
@@ -40,6 +40,8 @@
.Ft int
.Fn sem_wait "sem_t *sem"
.Ft int
+.Fn sem_timedwait "sem_t *sem" "const struct timespec *abstime"
+.Ft int
.Fn sem_trywait "sem_t *sem"
.Sh DESCRIPTION
The
@@ -51,6 +53,17 @@ but blocks if the value of
is zero, until the value is non-zero and the value can be decremented.
.Pp
The
+.Fn sem_timedwait
+function decrements (locks) the semaphore pointed to by
+.Fa sem ,
+but blocks if the value of
+.Fa sem
+is zero, until either the value is non-zero and can be decremented
+or the system time specified by
+.Fa abstime
+is reached.
+.Pp
+The
.Fn sem_trywait
function decrements (locks) the semaphore pointed to by
.Fa sem
@@ -58,9 +71,10 @@ only if the value is non-zero.
Otherwise, the semaphore is not decremented and
an error is returned.
.Sh RETURN VALUES
-.Rv -std sem_wait
+.Rv -std sem_wait sem_timedwait sem_trywait
.Sh ERRORS
-.Fn sem_wait
+.Fn sem_wait ,
+.Fn sem_timedwait ,
and
.Fn sem_trywait
will fail if:
@@ -71,6 +85,16 @@ points to an invalid semaphore.
.El
.Pp
Additionally,
+.Fn sem_timedwait
+will fail if:
+.Bl -tag -width Er
+.It Bq Er ETIMEDOUT
+The semaphore value was zero and could not be decremented before
+.Fa abstime
+was reached.
+.El
+.Pp
+Additionally,
.Fn sem_trywait
will fail if:
.Bl -tag -width Er
@@ -84,8 +108,9 @@ The semaphore value was zero, and thus could not be decremented.
.Xr sem_open 3 ,
.Xr sem_post 3
.Sh STANDARDS
-.Fn sem_wait
+.Fn sem_wait ,
+.Fn sem_timedwait ,
and
.Fn sem_trywait
conform to
-.St -p1003.1-96 .
+.St -p1003.1-2008 .