[asterisk-commits] file: branch 1.4 r77771 - /branches/1.4/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 30 10:47:52 CDT 2007


Author: file
Date: Mon Jul 30 10:47:52 2007
New Revision: 77771

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77771
Log:
(closes issue #10301)
Reported by: fnordian
Patches:
      asterisk-1.4.9-channel.c.patch uploaded by fnordian (license 110)
Restore previous behavior where if we failed to lock the channel we wanted we would return to exactly the same point as if we had just reentered the function.

Modified:
    branches/1.4/main/channel.c

Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=77771&r1=77770&r2=77771
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Mon Jul 30 10:47:52 2007
@@ -1032,6 +1032,7 @@
 	const char *msg = prev ? "deadlock" : "initial deadlock";
 	int retries;
 	struct ast_channel *c;
+	const struct ast_channel *_prev = prev;
 
 	for (retries = 0; retries < 10; retries++) {
 		int done;
@@ -1093,6 +1094,11 @@
 		AST_LIST_UNLOCK(&channels);
 		if (done)
 			return c;
+		/* If we reach this point we basically tried to lock a channel and failed. Instead of
+		 * starting from the beginning of the list we can restore our saved pointer to the previous
+		 * channel and start from there.
+		 */
+		prev = _prev;
 		usleep(1);	/* give other threads a chance before retrying */
 	}
 




More information about the asterisk-commits mailing list