[asterisk-commits] russell: trunk r104103 - in /trunk: ./ main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 25 17:19:31 CST 2008


Author: russell
Date: Mon Feb 25 17:19:31 2008
New Revision: 104103

URL: http://svn.digium.com/view/asterisk?view=rev&rev=104103
Log:
Merged revisions 104102 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104102 | russell | 2008-02-25 17:19:05 -0600 (Mon, 25 Feb 2008) | 7 lines

Improve the lock tracking code a bit so that a bunch of old locks that threads
failed to lock don't sit around in the history.  When a lock is first locked,
this checks to see if the last lock in the list was one that was failed to be
locked.  If it is, then that was a lock that we're no longer sitting in a trylock
loop trying to lock, so just remove it.
(inspired by issue #11712)

........

Modified:
    trunk/   (props changed)
    trunk/main/utils.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?view=diff&rev=104103&r1=104102&r2=104103
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Mon Feb 25 17:19:31 2008
@@ -610,7 +610,16 @@
 		pthread_mutex_unlock(&lock_info->lock);
 		return;
 	}
-	
+
+	if (i && lock_info->locks[i].pending == -1) {
+		/* The last lock on the list was one that this thread tried to lock but
+		 * failed at doing so.  It has now moved on to something else, so remove
+		 * the old lock from the list. */
+		i--;
+		lock_info->num_locks--;
+		memset(&lock_info->locks[i], 0, sizeof(lock_info->locks[0]));
+	}
+
 	lock_info->locks[i].file = filename;
 	lock_info->locks[i].line_num = line_num;
 	lock_info->locks[i].func = func;




More information about the asterisk-commits mailing list