Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2005 13:14:31 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 68252 for review
Message-ID:  <200501041314.j04DEVE3017245@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501041314.j04DEVE3017245>