summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2005-02-27 17:45:55 +0000
committerdelphij <delphij@FreeBSD.org>2005-02-27 17:45:55 +0000
commit55c4c85b99d476067caaa7a6802a7f97270d95a3 (patch)
tree67781a5ec41893d35a1515e4103d85aa850ee9e3 /lib/libkse
parent537769f6992aad9ba96045b70cc1e5995b8b245e (diff)
downloadFreeBSD-src-55c4c85b99d476067caaa7a6802a7f97270d95a3.zip
FreeBSD-src-55c4c85b99d476067caaa7a6802a7f97270d95a3.tar.gz
Change the spin lock logic to a reasonable one. We should spin when
the lock is held by other thread, but not when nobody owns it. According to deischen@, this part of code will never be hit in our threads library, since it does not use locks without wait/wakeup functions. Spotted by: mingyanguo via ChinaUnix.net forum Reviewed by: deischen
Diffstat (limited to 'lib/libkse')
-rw-r--r--lib/libkse/sys/lock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libkse/sys/lock.c b/lib/libkse/sys/lock.c
index e65b552..0f0f5f9 100644
--- a/lib/libkse/sys/lock.c
+++ b/lib/libkse/sys/lock.c
@@ -183,7 +183,7 @@ _lock_acquire(struct lock *lck, struct lockuser *lu, int prio)
atomic_store_rel_ptr(&lu->lu_watchreq->lr_watcher, lu);
if ((lck->l_wait == NULL) ||
((lck->l_type & LCK_ADAPTIVE) == 0)) {
- while (lu->lu_watchreq->lr_locked == 0)
+ while (lu->lu_watchreq->lr_locked != 0)
; /* spin, then yield? */
} else {
/*
OpenPOWER on IntegriCloud