summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorTobias Weingartner <weingart@cvs.openbsd.org>2009-04-25 20:14:44 +0000
committerTobias Weingartner <weingart@cvs.openbsd.org>2009-04-25 20:14:44 +0000
commit63236ac1c42847c6bcc02c8acb7093ae39774ff5 (patch)
tree8cb2a2f6f6bd68a9532e6eb57af0df12c6ede76d /sys/arch/sparc
parent7cd46f20cc6a6ba8a5bf692f17ccd7d9571b6bbb (diff)
Enter mtx_enter_try. In part for completeness, things may start
using this soon(ish). Ok oga@, sorta yes kettenis@.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/sparc/mutex.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/arch/sparc/sparc/mutex.c b/sys/arch/sparc/sparc/mutex.c
index 5e1440e59e8..f7be09e6a7a 100644
--- a/sys/arch/sparc/sparc/mutex.c
+++ b/sys/arch/sparc/sparc/mutex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.c,v 1.1 2007/02/03 20:08:50 miod Exp $ */
+/* $OpenBSD: mutex.c,v 1.2 2009/04/25 20:14:43 weingart Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -63,6 +63,17 @@ mtx_enter(struct mutex *mtx)
mtx->mtx_lock = 1;
}
+int
+mtx_enter_try(struct mutex *mtx)
+{
+ if (mtx->mtx_wantipl != IPL_NONE)
+ mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl);
+ MUTEX_ASSERT_UNLOCKED(mtx);
+ mtx->mtx_lock = 1;
+
+ return 1;
+}
+
void
mtx_leave(struct mutex *mtx)
{