summaryrefslogtreecommitdiff
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2001-09-22 21:19:55 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2001-09-22 21:19:55 +0000
commitdde96c99330470de413e18f35b2251e00667f347 (patch)
treeed2cebe192cb68127b459af5d58946dacac44eb8 /sys/kern/kern_mutex.c
parent0038106f4dc4e6ec192a5ebd94fa6b4cf95bd8a9 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 97c6b491dbee..bd4f6d13fa09 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -229,28 +229,48 @@ void
_mtx_lock_flags(struct mtx *m, int opts, const char *file, int line)
{
- __mtx_lock_flags(m, opts, file, line);
+ MPASS(curthread != NULL);
+ KASSERT((opts & MTX_NOSWITCH) == 0,
+ ("MTX_NOSWITCH used at %s:%d", file, line));
+ _get_sleep_lock(m, curthread, opts, file, line);
+ LOCK_LOG_LOCK("LOCK", &m->mtx_object, opts, m->mtx_recurse, file,
+ line);
+ WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line);
}
void
_mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
{
- __mtx_unlock_flags(m, opts, file, line);
+ MPASS(curthread != NULL);
+ mtx_assert((m), MA_OWNED);
+ WITNESS_UNLOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line);
+ LOCK_LOG_LOCK("UNLOCK", &m->mtx_object, opts, m->mtx_recurse, file,
+ line);
+ _rel_sleep_lock(m, curthread, opts, file, line);
}
void
_mtx_lock_spin_flags(struct mtx *m, int opts, const char *file, int line)
{
- __mtx_lock_spin_flags(m, opts, file, line);
+ MPASS(curthread != NULL);
+ _get_spin_lock(m, curthread, opts, file, line);
+ LOCK_LOG_LOCK("LOCK", &m->mtx_object, opts, m->mtx_recurse, file,
+ line);
+ WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line);
}
void
_mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
{
- __mtx_unlock_spin_flags(m, opts, file, line);
+ MPASS(curthread != NULL);
+ mtx_assert((m), MA_OWNED);
+ WITNESS_UNLOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line);
+ LOCK_LOG_LOCK("UNLOCK", &m->mtx_object, opts, m->mtx_recurse, file,
+ line);
+ _rel_spin_lock(m);
}
/*