http://perforce.freebsd.org/chv.cgi?CH=68252
Change 68252 by davidxu@davidxu_tiger on 2005/01/04 13:14:06
insert "pause" instructor for i386.
style fix.
Affected files ...
.. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_pspinlock.c#7
edit
Differences ...
==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_pspinlock.c#7
(text+ko) ====
@@ -100,6 +100,10 @@
else {
count = SPIN_COUNT;
while ((ret = umtx_trylock(&lck->s_lock, self->tid)) != 0) {
+#ifdef __i386__
+ /* tell cpu we are spinning */
+ __asm __volatile("pause");
+#endif
if (--count <= 0) {
count = SPIN_COUNT;
_pthread_yield();
@@ -120,7 +124,7 @@
if (lock == NULL || (lck = *lock) == NULL)
ret = EINVAL;
else {
- ret =umtx_unlock(&lck->s_lock, self->tid);
+ ret = umtx_unlock(&lck->s_lock, self->tid);
}
return (ret);
}