diff options
| author | Alan Cox <alc@FreeBSD.org> | 1999-11-11 03:02:03 +0000 |
|---|---|---|
| committer | Alan Cox <alc@FreeBSD.org> | 1999-11-11 03:02:03 +0000 |
| commit | 99c9d3490b96615ab51aacd966105d36b2841187 (patch) | |
| tree | 320429b6f366606616dfff7f20e4e73e46c2d657 /sys/kern/kern_lock.c | |
| parent | 0c38fb034081d9125fd0f99052a1e1d7810d89bb (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_lock.c')
| -rw-r--r-- | sys/kern/kern_lock.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 2b4cef15a3cc..d80561dfe8aa 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -103,23 +103,25 @@ shareunlock(struct lock *lkp, int decr) { * optimization troubles. */ static int -apause(struct lock *lkp, int flags) { - int lock_wait; - lock_wait = LOCK_WAIT_TIME; - for (; lock_wait > 0; lock_wait--) { - int i; - if ((lkp->lk_flags & flags) == 0) - return 0; +apause(struct lock *lkp, int flags) +{ +#ifdef SMP + int i, lock_wait; +#endif + + if ((lkp->lk_flags & flags) == 0) + return 0; +#ifdef SMP + for (lock_wait = LOCK_WAIT_TIME; lock_wait > 0; lock_wait--) { simple_unlock(&lkp->lk_interlock); - for (i = LOCK_SAMPLE_WAIT; i > 0; i--) { - if ((lkp->lk_flags & flags) == 0) { - simple_lock(&lkp->lk_interlock); - if ((lkp->lk_flags & flags) == 0) - return 0; + for (i = LOCK_SAMPLE_WAIT; i > 0; i--) + if ((lkp->lk_flags & flags) == 0) break; - } - } + simple_lock(&lkp->lk_interlock); + if ((lkp->lk_flags & flags) == 0) + return 0; } +#endif return 1; } |
