summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-09-22 21:19:55 +0000
committerjhb <jhb@FreeBSD.org>2001-09-22 21:19:55 +0000
commit9426cdbe394ea7f3120f023fb356b022ba303fef (patch)
treeed2cebe192cb68127b459af5d58946dacac44eb8 /sys/kern/kern_mutex.c
parentcba438d63ffdf61f735025d74c7c7f3ad5ca24bd (diff)
downloadFreeBSD-src-9426cdbe394ea7f3120f023fb356b022ba303fef.zip
FreeBSD-src-9426cdbe394ea7f3120f023fb356b022ba303fef.tar.gz
Since we no longer inline any debugging code in the mutex operations, move
all the debugging code into the function versions of the mutex operations in kern_mutex.c. This reduced the __mtx_* macros to simply wrappers of the _{get,rel}_lock_* macros, so the __mtx_* macros were also abolished in favor of just calling the _{get,rel}_lock_* macros. The tangled hairy mass of macros calling macros is at least a bit more sane now.
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 97c6b49..bd4f6d1 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);
}
/*
OpenPOWER on IntegriCloud