summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/mutex.h
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-09-09 23:18:48 +0000
committerjasone <jasone@FreeBSD.org>2000-09-09 23:18:48 +0000
commite454be9f46227fc056471526ff9507251ff5b61e (patch)
treeab0c678ecf9da44e033f686cc7713784e11be49c /sys/i386/include/mutex.h
parent9d6c8a5123d3247d48e39522c2b84a8875421dc8 (diff)
downloadFreeBSD-src-e454be9f46227fc056471526ff9507251ff5b61e.zip
FreeBSD-src-e454be9f46227fc056471526ff9507251ff5b61e.tar.gz
Style cleanups. No functional changes.
Diffstat (limited to 'sys/i386/include/mutex.h')
-rw-r--r--sys/i386/include/mutex.h79
1 files changed, 37 insertions, 42 deletions
diff --git a/sys/i386/include/mutex.h b/sys/i386/include/mutex.h
index 6d63557..b19bfa9 100644
--- a/sys/i386/include/mutex.h
+++ b/sys/i386/include/mutex.h
@@ -610,55 +610,50 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0,
STR_mtx_bad_type);
- do {
- if ((type) & MTX_SPIN) {
+ if ((type) & MTX_SPIN) {
+ /*
+ * Easy cases of spin locks:
+ *
+ * 1) We already own the lock and will simply recurse on it (if
+ * RLIKELY)
+ *
+ * 2) The lock is free, we just get it
+ */
+ if ((type) & MTX_RLIKELY) {
/*
- * Easy cases of spin locks:
- *
- * 1) We already own the lock and will simply
- * recurse on it (if RLIKELY)
- *
- * 2) The lock is free, we just get it
+ * Check for recursion, if we already have this
+ * lock we just bump the recursion count.
*/
- if ((type) & MTX_RLIKELY) {
- /*
- * Check for recursion, if we already
- * have this lock we just bump the
- * recursion count.
- */
- if (mpp->mtx_lock == CURTHD) {
- mpp->mtx_recurse++;
- break; /* Done */
- }
+ if (mpp->mtx_lock == CURTHD) {
+ mpp->mtx_recurse++;
+ goto done;
}
+ }
- if (((type) & MTX_TOPHALF) == 0) {
- /*
- * If an interrupt thread uses this
- * we must block interrupts here.
- */
- if ((type) & MTX_FIRST) {
- ASS_IEN;
- disable_intr();
- _getlock_norecurse(mpp, CURTHD,
- (type) & MTX_HARDOPTS);
- } else {
- _getlock_spin_block(mpp, CURTHD,
- (type) & MTX_HARDOPTS);
- }
- } else
+ if (((type) & MTX_TOPHALF) == 0) {
+ /*
+ * If an interrupt thread uses this we must block
+ * interrupts here.
+ */
+ if ((type) & MTX_FIRST) {
+ ASS_IEN;
+ disable_intr();
_getlock_norecurse(mpp, CURTHD,
(type) & MTX_HARDOPTS);
- } else {
- /* Sleep locks */
- if ((type) & MTX_RLIKELY)
- _getlock_sleep(mpp, CURTHD,
- (type) & MTX_HARDOPTS);
- else
- _getlock_norecurse(mpp, CURTHD,
+ } else {
+ _getlock_spin_block(mpp, CURTHD,
(type) & MTX_HARDOPTS);
- }
- } while (0);
+ }
+ } else
+ _getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ } else {
+ /* Sleep locks */
+ if ((type) & MTX_RLIKELY)
+ _getlock_sleep(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ else
+ _getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ }
+ done:
WITNESS_ENTER(mpp, type, file, line);
CTR5(KTR_LOCK, STR_mtx_enter_fmt,
mpp->mtx_description, mpp, file, line,
OpenPOWER on IntegriCloud