summaryrefslogtreecommitdiff
path: root/sys/arch/hppa64
diff options
context:
space:
mode:
authorTobias Weingartner <weingart@cvs.openbsd.org>2009-08-13 13:24:56 +0000
committerTobias Weingartner <weingart@cvs.openbsd.org>2009-08-13 13:24:56 +0000
commit12e07bde626971f0b6038b2e0779443ce161e178 (patch)
treed88677388bcf55b9698dc17194f0de869a2f4c60 /sys/arch/hppa64
parent29809d2f1e8c02ea2b0ede0ef698eeadae085716 (diff)
A new(er) mtx_enter_try().
Ok oga@, "the time is now" deraadt@.
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r--sys/arch/hppa64/hppa64/mutex.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/arch/hppa64/hppa64/mutex.c b/sys/arch/hppa64/hppa64/mutex.c
index 0752b964669..8f9d5ebf9a4 100644
--- a/sys/arch/hppa64/hppa64/mutex.c
+++ b/sys/arch/hppa64/hppa64/mutex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.c,v 1.3 2009/04/27 21:48:56 kettenis Exp $ */
+/* $OpenBSD: mutex.c,v 1.4 2009/08/13 13:24:55 weingart Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -54,6 +54,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)
{