[asterisk-commits] may: branch may/ooh323_ipv6_direct_rtp r364574 - in /team/may/ooh323_ipv6_dir...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Apr 29 02:42:25 CDT 2012


Author: may
Date: Sun Apr 29 02:42:18 2012
New Revision: 364574

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=364574
Log:
Use ast_channel_lock_both() where it was inlined before.

The CHANNEL_DEADLOCK_AVOIDANCE() feature of preserving where the channel
lock was originally obtained is overkill where ast_channel_lock_both() was
inlined.
........

Merged revisions 362888 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/may/ooh323_ipv6_direct_rtp/   (props changed)
    team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_local.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_misdn.c
    team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 29 02:42:18 2012
@@ -1,1 +1,1 @@
-/trunk:331201-331202,346391,354429,356042,357272,360190
+/trunk:331201-331202,346391,354429,356042,357272,360190,362888

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Apr 29 02:42:18 2012
@@ -1,1 +1,1 @@
-/trunk:1-313481,313483-313906,313908-313943,313945-362884
+/trunk:1-313481,313483-313906,313908-313943,313945-362884,362888

Modified: team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c?view=diff&rev=364574&r1=364573&r2=364574
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c Sun Apr 29 02:42:18 2012
@@ -902,15 +902,13 @@
 	} else {
 		struct ast_party_redirecting redirecting;
 
+		ast_channel_lock_both(c, in);
+
 		if (single_caller_bored && CAN_EARLY_BRIDGE(peerflags, c, in)) {
 			ast_rtp_instance_early_bridge_make_compatible(c, in);
 		}
 
 		ast_channel_set_redirecting(c, ast_channel_redirecting(original), NULL);
-		ast_channel_lock(c);
-		while (ast_channel_trylock(in)) {
-			CHANNEL_DEADLOCK_AVOIDANCE(c);
-		}
 		if (!ast_channel_redirecting(c)->from.number.valid
 			|| ast_strlen_zero(ast_channel_redirecting(c)->from.number.str)) {
 			/*
@@ -986,10 +984,7 @@
 			c = o->chan = NULL;
 			num->nochan++;
 		} else {
-			ast_channel_lock(c);
-			while (ast_channel_trylock(in)) {
-				CHANNEL_DEADLOCK_AVOIDANCE(c);
-			}
+			ast_channel_lock_both(c, in);
 			senddialevent(in, c, stuff);
 			ast_channel_unlock(in);
 			ast_channel_unlock(c);
@@ -2295,10 +2290,8 @@
 		}
 		pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
 
-		ast_channel_lock(tc);
-		while (ast_channel_trylock(chan)) {
-			CHANNEL_DEADLOCK_AVOIDANCE(tc);
-		}
+		ast_channel_lock_both(tc, chan);
+
 		/* Setup outgoing SDP to match incoming one */
 		if (!outgoing && !rest && CAN_EARLY_BRIDGE(peerflags, chan, tc)) {
 			ast_rtp_instance_early_bridge_make_compatible(tc, chan);

Modified: team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c?view=diff&rev=364574&r1=364573&r2=364574
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c Sun Apr 29 02:42:18 2012
@@ -7302,10 +7302,7 @@
 	if (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))
 		return AST_BRIDGE_FAILED_NOWARN;
 
-	ast_channel_lock(c0);
-	while (ast_channel_trylock(c1)) {
-		CHANNEL_DEADLOCK_AVOIDANCE(c0);
-	}
+	ast_channel_lock_both(c0, c1);
 
 	p0 = ast_channel_tech_pvt(c0);
 	p1 = ast_channel_tech_pvt(c1);
@@ -7513,10 +7510,7 @@
 		/* Here's our main loop...  Start by locking things, looking for private parts,
 		   and then balking if anything is wrong */
 
-		ast_channel_lock(c0);
-		while (ast_channel_trylock(c1)) {
-			CHANNEL_DEADLOCK_AVOIDANCE(c0);
-		}
+		ast_channel_lock_both(c0, c1);
 
 		p0 = ast_channel_tech_pvt(c0);
 		p1 = ast_channel_tech_pvt(c1);

Modified: team/may/ooh323_ipv6_direct_rtp/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/chan_local.c?view=diff&rev=364574&r1=364573&r2=364574
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_local.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_local.c Sun Apr 29 02:42:18 2012
@@ -194,10 +194,7 @@
 			ao2_lock(p);
 		} else {
 			/* lock both channels first, then get the pvt lock */
-			ast_channel_lock(chan);
-			while (ast_channel_trylock(owner)) {
-				CHANNEL_DEADLOCK_AVOIDANCE(chan);
-			}
+			ast_channel_lock_both(chan, owner);
 			ao2_lock(p);
 		}
 

Modified: team/may/ooh323_ipv6_direct_rtp/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/chan_misdn.c?view=diff&rev=364574&r1=364573&r2=364574
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_misdn.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_misdn.c Sun Apr 29 02:42:18 2012
@@ -8560,10 +8560,7 @@
 		return -1;
 	}
 
-	ast_channel_lock(held_ch->ast);
-	while (ast_channel_trylock(active_ch->ast)) {
-		CHANNEL_DEADLOCK_AVOIDANCE(held_ch->ast);
-	}
+	ast_channel_lock_both(held_ch->ast, active_ch->ast);
 
 	transferee = ast_bridged_channel(held_ch->ast);
 	if (!transferee) {

Modified: team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c?view=diff&rev=364574&r1=364573&r2=364574
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c Sun Apr 29 02:42:18 2012
@@ -1452,12 +1452,7 @@
 	int res = 0;
 
 	/* Lock both channels so we can look for the glue that binds them together */
-	ast_channel_lock(c0);
-	while (ast_channel_trylock(c1)) {
-		ast_channel_unlock(c0);
-		usleep(1);
-		ast_channel_lock(c0);
-	}
+	ast_channel_lock_both(c0, c1);
 
 	if (!cap1 || !cap0) {
 		goto done;




More information about the asterisk-commits mailing list