[asterisk-commits] russell: branch 1.2 r38200 - /branches/1.2/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jul 25 12:43:39 MST 2006


Author: russell
Date: Tue Jul 25 14:43:38 2006
New Revision: 38200

URL: http://svn.digium.com/view/asterisk?rev=38200&view=rev
Log:
This resolves a deadlock that a tech support customer was getting frequently
when his users would answer call waiting. If another thread is currently
holding the zt_pvt lock for the first channel, unlock both channels and let
asterisk retry the native bridge, just like what is done for the second channel
directly below these changes.

Modified:
    branches/1.2/channels/chan_zap.c

Modified: branches/1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_zap.c?rev=38200&r1=38199&r2=38200&view=diff
==============================================================================
--- branches/1.2/channels/chan_zap.c (original)
+++ branches/1.2/channels/chan_zap.c Tue Jul 25 14:43:38 2006
@@ -3047,7 +3047,13 @@
 	oc0 = p0->owner;
 	oc1 = p1->owner;
 
-	ast_mutex_lock(&p0->lock);
+	if (ast_mutex_trylock(&p0->lock)) {
+		/* Don't block, due to potential for deadlock */
+		ast_mutex_unlock(&c0->lock);
+		ast_mutex_unlock(&c1->lock);
+		ast_log(LOG_NOTICE, "Avoiding deadlock...\n");
+		return AST_BRIDGE_RETRY;
+	}
 	if (ast_mutex_trylock(&p1->lock)) {
 		/* Don't block, due to potential for deadlock */
 		ast_mutex_unlock(&p0->lock);



More information about the asterisk-commits mailing list