[asterisk-commits] [svn-commits] file: branch file/bridging r106326 - /team/file/bridging/main/bridging.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 5 22:02:49 CST 2008


Author: file
Date: Wed Mar  5 22:02:49 2008
New Revision: 106326

URL: http://svn.digium.com/view/asterisk?view=rev&rev=106326
Log:
It is entirely possible that during a smart bridge operation the new bridge technology wants to switch the threading model for each bridged channel so let's make it happen.

Modified:
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=106326&r1=106325&r2=106326
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Wed Mar  5 22:02:49 2008
@@ -561,6 +561,9 @@
 			if (new_technology->join(bridge, bridge_channel2))
 				ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n", new_technology->name, bridge_channel2, bridge);
 		}
+		/* Fourth we notify the bridge channel so they can call the respective bridge channel thread function */
+		pthread_kill(bridge_channel2->thread, SIGURG);
+		ast_cond_signal(&bridge_channel2->cond);
 	}
 
 	/* Now that all the channels are gone the old bridge technology destruction can be finalized */
@@ -588,6 +591,7 @@
 /*! \brief Run in a multithreaded model. Each joined channel does writing/reading in their own thread. */
 static enum ast_bridge_channel_state bridge_channel_join_multithreaded(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
+	struct ast_bridge_technology *technology = bridge->technology;
 	int fds[4] = {-1, }, nfds = 0, i = 0;
 
 	/* Add any file descriptors to be watched if a callback function exists for them */
@@ -601,7 +605,7 @@
 	}
 
 	/* Go into a loop waiting for frames from the channel, or the associated file descriptors to trip */
-	while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
+	while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT && technology == bridge->technology) {
 		struct ast_channel *chan = NULL;
 		int outfd = -1, ms = -1;
 
@@ -623,8 +627,10 @@
 /*! \brief Run in a singlethreaded model. Each joined channel yields itself to the main bridge thread. */
 static enum ast_bridge_channel_state bridge_channel_join_singlethreaded(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
+	struct ast_bridge_technology *technology = bridge->technology;
+
 	/* Go into a loop waiting for the bridge thread to make us do something */
-	for (;;) {
+	while (technology == bridge->technology) {
 		if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
 			ast_debug(1, "Bridge channel %p entering signalling wait state.\n", bridge_channel);
 			ast_cond_wait(&bridge_channel->cond, &bridge->lock);


_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits





More information about the asterisk-commits mailing list