[asterisk-commits] pabelanger: trunk r266877 - /trunk/main/bridging.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 2 08:32:28 CDT 2010


Author: pabelanger
Date: Wed Jun  2 08:32:22 2010
New Revision: 266877

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=266877
Log:
pthread_join to assure the thread is really gone

(closes issue #15465)
Reported by: fnordian
Patches:
      bridging.patch uploaded by fnordian (license 110)
Tested by: lmadsen, fnordian, peterh

Review: https://reviewboard.asterisk.org/r/679/

Modified:
    trunk/main/bridging.c

Modified: trunk/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridging.c?view=diff&rev=266877&r1=266876&r2=266877
==============================================================================
--- trunk/main/bridging.c (original)
+++ trunk/main/bridging.c Wed Jun  2 08:32:22 2010
@@ -635,11 +635,16 @@
 		if (new_technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD) {
 			ast_debug(1, "Telling current bridge thread for bridge %p to refresh\n", bridge);
 			bridge->refresh = 1;
+			bridge_poke(bridge);
 		} else {
+			pthread_t bridge_thread = bridge->thread;
 			ast_debug(1, "Telling current bridge thread for bridge %p to stop\n", bridge);
 			bridge->stop = 1;
-		}
-		bridge_poke(bridge);
+			bridge_poke(bridge);
+			ao2_unlock(bridge);
+			pthread_join(bridge_thread, NULL);
+			ao2_lock(bridge);
+		}
 	}
 
 	/* Since we are soon going to pass this bridge to a new technology we need to NULL out the bridge_pvt pointer but don't worry as it still exists in temp_bridge, ditto for the old technology */




More information about the asterisk-commits mailing list