summaryrefslogtreecommitdiff
path: root/lib/libpthread/man/pthread_rwlock_rdlock.3
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-04-12 01:54:24 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-04-12 01:54:24 +0000
commit41c1a3e3e6683fe9b4edf023cd5a862fd79746b0 (patch)
treeefce53ab5ec5de44259e6fae7768cc9358cbce71 /lib/libpthread/man/pthread_rwlock_rdlock.3
parent46975a2a516f3489a5273d971ef327e5c5fd681e (diff)
Add support for pthread_rwlock_timed locks.
from brad. ok kurt, who's too busy to commit
Diffstat (limited to 'lib/libpthread/man/pthread_rwlock_rdlock.3')
-rw-r--r--lib/libpthread/man/pthread_rwlock_rdlock.340
1 files changed, 32 insertions, 8 deletions
diff --git a/lib/libpthread/man/pthread_rwlock_rdlock.3 b/lib/libpthread/man/pthread_rwlock_rdlock.3
index 2102c6a74a9..5be678b7675 100644
--- a/lib/libpthread/man/pthread_rwlock_rdlock.3
+++ b/lib/libpthread/man/pthread_rwlock_rdlock.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pthread_rwlock_rdlock.3,v 1.8 2007/05/31 19:19:37 jmc Exp $
+.\" $OpenBSD: pthread_rwlock_rdlock.3,v 1.9 2010/04/12 01:54:23 tedu Exp $
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
@@ -25,11 +25,12 @@
.\"
.\" $FreeBSD: pthread_rwlock_rdlock.3,v 1.2 1999/08/28 00:03:09 peter Exp $
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: April 12 2010 $
.Dt PTHREAD_RWLOCK_RDLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_rdlock ,
+.Nm pthread_rwlock_timedrdlock ,
.Nm pthread_rwlock_tryrdlock
.Nd acquire a read/write lock for reading
.Sh SYNOPSIS
@@ -37,6 +38,8 @@
.Ft int
.Fn pthread_rwlock_rdlock "pthread_rwlock_t *lock"
.Ft int
+.Fn pthread_rwlock_timedrdlock "pthread_rwlock_t *lock" "const struct timespec *abstime"
+.Ft int
.Fn pthread_rwlock_tryrdlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
@@ -51,10 +54,18 @@ If the read lock cannot be immediately acquired,
the calling thread blocks until it can acquire the lock.
.Pp
The
+.Fn pthread_rwlock_timedrdlock
+function performs the same action,
+but will not wait beyond
+.Fa abstime
+to obtain the lock before returning.
+.Pp
+The
.Fn pthread_rwlock_tryrdlock
-function performs the same action, but does not block if the lock
-cannot be immediately obtained (i.e., the lock is held for writing
-or there are waiting writers).
+function performs the same action as
+.Fn pthread_rwlock_rdlock ,
+but does not block if the lock cannot be immediately obtained
+(i.e., the lock is held for writing or there are writers waiting).
.Pp
A thread may hold multiple concurrent read locks.
If so,
@@ -67,7 +78,8 @@ a write lock are undefined.
To prevent writer starvation, writers are favored over readers.
.Sh RETURN VALUES
If successful, the
-.Fn pthread_rwlock_rdlock
+.Fn pthread_rwlock_rdlock ,
+.Fn pthread_rwlock_timedrdlock ,
and
.Fn pthread_rwlock_tryrdlock
functions will return zero.
@@ -83,7 +95,18 @@ was blocked on it.
.El
.Pp
The
-.Fn pthread_rwlock_rdlock
+.Fn pthread_rwlock_timedrdlock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ETIMEDOUT
+The time specified by
+.Fa abstime
+was reached before the lock could be obtained.
+.El
+.Pp
+The
+.Fn pthread_rwlock_rdlock ,
+.Fn pthread_rwlock_timedrdlock ,
and
.Fn pthread_rwlock_tryrdlock
functions may fail if:
@@ -112,7 +135,8 @@ statically initialized locks only).
.Xr pthread_rwlock_wrlock 3
.Sh STANDARDS
The
-.Fn pthread_rwlock_rdlock
+.Fn pthread_rwlock_rdlock ,
+.Fn pthread_rwlock_timedrdlock ,
and
.Fn pthread_rwlock_tryrdlock
functions are expected to conform to