[asterisk-commits] russell: trunk r84784 - in /trunk: ./ channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 11:49:16 CDT 2007


Author: russell
Date: Fri Oct  5 11:49:16 2007
New Revision: 84784

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

........
r84783 | russell | 2007-10-05 11:44:21 -0500 (Fri, 05 Oct 2007) | 4 lines

Do deadlock avoidance in a couple more places.  You can't lock two channels
at the same time without doing extra work to make sure it succeeds.
(closes issue #10895, patch by me)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_zap.c

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

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=84784&r1=84783&r2=84784
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri Oct  5 11:49:16 2007
@@ -3475,7 +3475,11 @@
 		return AST_BRIDGE_FAILED_NOWARN;
 
 	ast_channel_lock(c0);
-	ast_channel_lock(c1);
+	while (ast_channel_trylock(c1)) {
+		ast_channel_unlock(c0);
+		usleep(1);
+		ast_channel_lock(c0);
+	}
 
 	p0 = c0->tech_pvt;
 	p1 = c1->tech_pvt;
@@ -3641,8 +3645,13 @@
 
 		/* Here's our main loop...  Start by locking things, looking for private parts, 
 		   and then balking if anything is wrong */
+		
 		ast_channel_lock(c0);
-		ast_channel_lock(c1);
+		while (ast_channel_trylock(c1)) {
+			ast_channel_unlock(c0);
+			usleep(1);
+			ast_channel_lock(c0);
+		}
 
 		p0 = c0->tech_pvt;
 		p1 = c1->tech_pvt;




More information about the asterisk-commits mailing list