aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2006-06-03 21:11:33 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2006-06-03 21:11:33 +0000
commit49b94bfc54b617782de9f235dd59702b64f0022b (patch)
tree90c4315ce032709aa7289d88b5a9e68f10ada59e /sys/kern/kern_mutex.c
parentf99cc4ad59e7a48928c6bfe4fa788ea0c1171bd8 (diff)
downloadsrc-49b94bfc54b617782de9f235dd59702b64f0022b.tar.gz
src-49b94bfc54b617782de9f235dd59702b64f0022b.zip
Bah, fix fat finger in last. Invert the ~ on MTX_FLAGMASK as it's
non-intuitive for the ~ to be built into the mask. All the users now explicitly ~ the mask. In addition, add MTX_UNOWNED to the mask even though it technically isn't a flag. This should unbreak mtx_owner(). Quickly spotted by: kris
Notes
Notes: svn path=/head/; revision=159208
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 65b8300921e6..634fa9d82627 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -85,7 +85,7 @@ __FBSDID("$FreeBSD$");
*/
#define mtx_unowned(m) ((m)->mtx_lock == MTX_UNOWNED)
-#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & (MTX_FLAGMASK|MTX_UNOWNED)))
+#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & ~MTX_FLAGMASK))
#ifdef DDB
static void db_show_mtx(struct lock_object *lock);
@@ -527,7 +527,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file,
* If the current owner of the lock is executing on another
* CPU, spin instead of blocking.
*/
- owner = (struct thread *)(v & MTX_FLAGMASK);
+ owner = (struct thread *)(v & ~MTX_FLAGMASK);
#ifdef ADAPTIVE_GIANT
if (TD_IS_RUNNING(owner)) {
#else