diff options
author | Tobias Weingartner <weingart@cvs.openbsd.org> | 2009-04-25 20:14:44 +0000 |
---|---|---|
committer | Tobias Weingartner <weingart@cvs.openbsd.org> | 2009-04-25 20:14:44 +0000 |
commit | 63236ac1c42847c6bcc02c8acb7093ae39774ff5 (patch) | |
tree | 8cb2a2f6f6bd68a9532e6eb57af0df12c6ede76d /share/man | |
parent | 7cd46f20cc6a6ba8a5bf692f17ccd7d9571b6bbb (diff) |
Enter mtx_enter_try. In part for completeness, things may start
using this soon(ish). Ok oga@, sorta yes kettenis@.
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man9/Makefile | 5 | ||||
-rw-r--r-- | share/man/man9/mutex.9 | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index bb68a7b5e74..b25798c1a64 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.151 2009/04/21 19:30:14 mk Exp $ +# $OpenBSD: Makefile,v 1.152 2009/04/25 20:14:42 weingart Exp $ # $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -219,7 +219,8 @@ MLINKS+=microtime.9 getmicrotime.9 microtime.9 microuptime.9 \ microtime.9 getnanouptime.9 microtime.9 bintime.9 \ microtime.9 binuptime.9 MLINKS+=mountroothook_establish.9 mountroothook_disestablish.9 -MLINKS+=mutex.9 mtx_init.9 mutex.9 mtx_enter.9 mutex.9 mtx_leave.9 +MLINKS+=mutex.9 mtx_init.9 mutex.9 mtx_enter.9 mutex.9 mtx_enter_try.9 \ + mutex.9 mtx_leave.9 MLINKS+=namei.9 lookup.9 namei.9 relookup.9 namei.9 NDINIT.9 MLINKS+=pci_conf_read.9 pci_conf_write.9 pci_conf_read.9 pci_make_tag.9 \ pci_conf_read.9 pci_decompose_tag.9 diff --git a/share/man/man9/mutex.9 b/share/man/man9/mutex.9 index 6574d75541f..f10b2992700 100644 --- a/share/man/man9/mutex.9 +++ b/share/man/man9/mutex.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mutex.9,v 1.7 2007/12/09 20:54:01 jmc Exp $ +.\" $OpenBSD: mutex.9,v 1.8 2009/04/25 20:14:42 weingart Exp $ .\" .\" Copyright (c) 2005 Pedro Martelletto <pedro@ambientworks.net> .\" All rights reserved. @@ -15,13 +15,14 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 9 2007 $ +.Dd $Mdocdate: April 25 2009 $ .Dt MUTEX 9 .Os .Sh NAME .Nm mutex , .Nm mtx_init , .Nm mtx_enter , +.Nm mtx_enter_try , .Nm mtx_leave .Nd interface to CPU mutexes .Sh SYNOPSIS @@ -30,6 +31,8 @@ .Fn mtx_init "struct mutex *mtxp" "int wantipl" .Ft void .Fn mtx_enter "struct mutex *mtxp" +.Ft int +.Fn mtx_enter_try "struct mutex *mtxp" .Ft void .Fn mtx_leave "struct mutex *mtxp" .Sh DESCRIPTION @@ -52,6 +55,12 @@ The function acquires a mutex, spinning if necessary. .Pp The +.Fn mtx_enter_try +function tries to acquire a mutex. +On success it will return a non-zero value, zero on failure. +It is recommended that this function only be used if absolutely necessary. +.Pp +The .Fn mtx_leave function releases a mutex. In case the acquisition of the mutex caused the interrupt level to be changed, |