summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2014-02-13 13:12:33 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2014-02-13 13:12:33 +0000
commit463d19dbea3acf1ad240aecd563259c07c886356 (patch)
treea03aa9ac12aa1c268a39227666ba5e3e44d76603 /share
parent0e6c54410e1708b812b3a1eb134007d5dcdb0fd1 (diff)
explicitely document the contexts you can call mutex functions in.
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/mutex.920
1 files changed, 15 insertions, 5 deletions
diff --git a/share/man/man9/mutex.9 b/share/man/man9/mutex.9
index 846327db808..888bafd9ff4 100644
--- a/share/man/man9/mutex.9
+++ b/share/man/man9/mutex.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mutex.9,v 1.19 2014/01/19 10:01:35 dlg Exp $
+.\" $OpenBSD: mutex.9,v 1.20 2014/02/13 13:12:32 dlg Exp $
.\"
.\" Copyright (c) 2005 Pedro Martelletto <pedro@ambientworks.net>
.\" All rights reserved.
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 19 2014 $
+.Dd $Mdocdate: February 13 2014 $
.Dt MUTEX 9
.Os
.Sh NAME
@@ -86,6 +86,19 @@ When acquired, the mutex will cause the processor interrupt level to be raised
to
.Fa wantipl
if necessary.
+.Sh CONTEXT
+.Fn mtx_init
+can be called during autoconf, from process context, or from interrupt
+context.
+.Pp
+.Fn mtx_enter ,
+.Fn mtx_enter_try ,
+and
+.Fn mtx_leave
+can be called during autoconf, from process context, or from any
+interrupt context at or below the interrupt level
+.Fa mtxp
+was initialised with.
.Sh SEE ALSO
.Xr lockmgr 9 ,
.Xr msleep 9 ,
@@ -104,9 +117,6 @@ functions were written by
.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