diff options
author | Tobias Weingartner <weingart@cvs.openbsd.org> | 2009-08-13 13:24:56 +0000 |
---|---|---|
committer | Tobias Weingartner <weingart@cvs.openbsd.org> | 2009-08-13 13:24:56 +0000 |
commit | 12e07bde626971f0b6038b2e0779443ce161e178 (patch) | |
tree | d88677388bcf55b9698dc17194f0de869a2f4c60 /sys/arch/arm | |
parent | 29809d2f1e8c02ea2b0ede0ef698eeadae085716 (diff) |
A new(er) mtx_enter_try().
Ok oga@, "the time is now" deraadt@.
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/s3c2xx0/s3c2xx0_mutex.c | 14 | ||||
-rw-r--r-- | sys/arch/arm/xscale/i80321_mutex.c | 14 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_mutex.c | 13 |
3 files changed, 38 insertions, 3 deletions
diff --git a/sys/arch/arm/s3c2xx0/s3c2xx0_mutex.c b/sys/arch/arm/s3c2xx0/s3c2xx0_mutex.c index 04c3332a1e5..e186a756ca7 100644 --- a/sys/arch/arm/s3c2xx0/s3c2xx0_mutex.c +++ b/sys/arch/arm/s3c2xx0/s3c2xx0_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3c2xx0_mutex.c,v 1.1 2008/11/26 14:39:14 drahn Exp $ */ +/* $OpenBSD: s3c2xx0_mutex.c,v 1.2 2009/08/13 13:24:55 weingart Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -58,6 +58,18 @@ mtx_enter(struct mutex *mtx) } void +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) { MUTEX_ASSERT_LOCKED(mtx); diff --git a/sys/arch/arm/xscale/i80321_mutex.c b/sys/arch/arm/xscale/i80321_mutex.c index c19da126124..9271d29c5ad 100644 --- a/sys/arch/arm/xscale/i80321_mutex.c +++ b/sys/arch/arm/xscale/i80321_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i80321_mutex.c,v 1.1 2007/05/15 05:26:44 miod Exp $ */ +/* $OpenBSD: i80321_mutex.c,v 1.2 2009/08/13 13:24:55 weingart Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -58,6 +58,18 @@ mtx_enter(struct mutex *mtx) } void +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) { MUTEX_ASSERT_LOCKED(mtx); diff --git a/sys/arch/arm/xscale/pxa2x0_mutex.c b/sys/arch/arm/xscale/pxa2x0_mutex.c index 605f9b02b56..6952105a8d6 100644 --- a/sys/arch/arm/xscale/pxa2x0_mutex.c +++ b/sys/arch/arm/xscale/pxa2x0_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_mutex.c,v 1.1 2007/05/15 05:26:44 miod Exp $ */ +/* $OpenBSD: pxa2x0_mutex.c,v 1.2 2009/08/13 13:24:55 weingart Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -57,6 +57,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) { |