summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-05-14 16:39:35 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-05-14 16:39:35 +0000
commit31c58c1227785032f5a34554a093758ac993a13f (patch)
treeeba3447aeab8083d90e88fdc2b9fe3960ec3fa6f
parent580d6d57f685db7b890620d6d0c0985d12540c1b (diff)
Add notes about sleeping with held locks and interrupt handler usage.
Based on comments by art, and tweaked by jmc. ok art@
-rw-r--r--share/man/man9/mutex.97
-rw-r--r--share/man/man9/rwlock.95
2 files changed, 10 insertions, 2 deletions
diff --git a/share/man/man9/mutex.9 b/share/man/man9/mutex.9
index b1b91b0aca9..416152d6c0d 100644
--- a/share/man/man9/mutex.9
+++ b/share/man/man9/mutex.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mutex.9,v 1.2 2007/05/13 11:34:25 jsg Exp $
+.\" $OpenBSD: mutex.9,v 1.3 2007/05/14 16:39:34 jsg Exp $
.\"
.\" Copyright (c) 2005 Pedro Martelletto <pedro@openbsd.org>
.\" All rights reserved.
@@ -71,6 +71,11 @@ functions were written by
.An Artur Grabowski
.Aq art@openbsd.org .
.Sh CAVEATS
+As these are spinning locks, don't sleep while holding one.
+.Pp
+If using a mutex in an interrupt handler, locks must be initialised
+with the correct IPL or deadlock will occur.
+.Pp
Multiple mutexes may be nested, but not interleaved.
This is okay:
.Bd -literal -offset indent
diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9
index d1773fab23a..1bc64e52155 100644
--- a/share/man/man9/rwlock.9
+++ b/share/man/man9/rwlock.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rwlock.9,v 1.5 2007/04/10 21:07:48 art Exp $
+.\" $OpenBSD: rwlock.9,v 1.6 2007/05/14 16:39:34 jsg Exp $
.\"
.\" Copyright (c) 2006 Pedro Martelletto <pedro@openbsd.org>
.\" All rights reserved.
@@ -127,3 +127,6 @@ The
functions were written by
.An Artur Grabowski
.Aq art@openbsd.org .
+.Sh CAVEATS
+While it is safe to sleep with an rwlock held, they cannot
+be used in an interrupt handler as an rwlock is bound to a process.