[svn-commits] rmudgett: branch 12 r397650 - in /branches/12: include/asterisk/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 26 11:24:53 CDT 2013


Author: rmudgett
Date: Mon Aug 26 11:24:51 2013
New Revision: 397650

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397650
Log:
bridging: Fix a livelock with local channel optimization.

Use a better means of waking up the bridge channel thread.

Modified:
    branches/12/include/asterisk/bridge_channel.h
    branches/12/main/bridge_channel.c

Modified: branches/12/include/asterisk/bridge_channel.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/bridge_channel.h?view=diff&rev=397650&r1=397649&r2=397650
==============================================================================
--- branches/12/include/asterisk/bridge_channel.h (original)
+++ branches/12/include/asterisk/bridge_channel.h Mon Aug 26 11:24:51 2013
@@ -144,8 +144,6 @@
 	AST_LIST_HEAD_NOLOCK(, ast_frame) wr_queue;
 	/*! Pipe to alert thread when frames are put into the wr_queue. */
 	int alert_pipe[2];
-	/*! TRUE if the bridge channel thread is waiting on channels (needs to be atomically settable) */
-	int waiting;
 	/*!
 	 * \brief The bridge channel thread activity.
 	 *

Modified: branches/12/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/bridge_channel.c?view=diff&rev=397650&r1=397649&r2=397650
==============================================================================
--- branches/12/main/bridge_channel.c (original)
+++ branches/12/main/bridge_channel.c Mon Aug 26 11:24:51 2013
@@ -110,10 +110,8 @@
 static void bridge_channel_poke(struct ast_bridge_channel *bridge_channel)
 {
 	if (!pthread_equal(pthread_self(), bridge_channel->thread)) {
-		while (bridge_channel->waiting) {
-			pthread_kill(bridge_channel->thread, SIGURG);
-			sched_yield();
-		}
+		/* Wake up the bridge channel thread. */
+		ast_queue_frame(bridge_channel->chan, &ast_null_frame);
 	}
 }
 
@@ -1883,13 +1881,11 @@
 		ast_debug(10, "Bridge %s: %p(%s) is going into a waitfor\n",
 			bridge_channel->bridge->uniqueid, bridge_channel,
 			ast_channel_name(bridge_channel->chan));
-		bridge_channel->waiting = 1;
 		ast_bridge_channel_unlock(bridge_channel);
 		outfd = -1;
 		ms = bridge_channel_next_interval(bridge_channel);
 		chan = ast_waitfor_nandfds(&bridge_channel->chan, 1,
 			&bridge_channel->alert_pipe[0], 1, NULL, &outfd, &ms);
-		bridge_channel->waiting = 0;
 		if (ast_channel_softhangup_internal_flag(bridge_channel->chan) & AST_SOFTHANGUP_UNBRIDGE) {
 			ast_channel_clear_softhangup(bridge_channel->chan, AST_SOFTHANGUP_UNBRIDGE);
 			ast_bridge_channel_lock_bridge(bridge_channel);




More information about the svn-commits mailing list