[svn-commits] mmichelson: trunk r125880 - /trunk/include/asterisk/lock.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 27 11:23:32 CDT 2008


Author: mmichelson
Date: Fri Jun 27 11:23:32 2008
New Revision: 125880

URL: http://svn.digium.com/view/asterisk?view=rev&rev=125880
Log:
Optimization suggested by Russell to cache the value of pthread_self() so
that it isn't evaluated every time through the loop.


Modified:
    trunk/include/asterisk/lock.h

Modified: trunk/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=125880&r1=125879&r2=125880
==============================================================================
--- trunk/include/asterisk/lock.h (original)
+++ trunk/include/asterisk/lock.h Fri Jun 27 11:23:32 2008
@@ -1051,8 +1051,9 @@
 	if (lt->reentrancy) {
 		int lock_found = 0;
 		int i;
+		pthread_t self = pthread_self();
 		for (i = lt->reentrancy-1; i >= 0; --i) {
-			if (lt->thread[i] == pthread_self()) {
+			if (lt->thread[i] == self) {
 				lock_found = 1;
 				if (i != lt->reentrancy-1) {
 					lt->file[i] = lt->file[lt->reentrancy-1];




More information about the svn-commits mailing list