[asterisk-commits] mmichelson: branch 10 r369709 - in /branches/10: ./ main/bridging.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 6 10:23:37 CDT 2012


Author: mmichelson
Date: Fri Jul  6 10:23:28 2012
New Revision: 369709

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369709
Log:
Fix bridging thread leak.

The bridge thread was exiting but was never being
reaped using pthread_join(). This has been fixed now
by calling pthread_join() in ast_bridge_destroy().

(closes issue ASTERISK-19834)
Reported by Marcus Hunger

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

Merged revisions 369708 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/main/bridging.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/bridging.c?view=diff&rev=369709&r1=369708&r2=369709
==============================================================================
--- branches/10/main/bridging.c (original)
+++ branches/10/main/bridging.c Fri Jul  6 10:23:28 2012
@@ -238,9 +238,6 @@
 		}
 	}
 
-	/* Since all the channels are going away let's go ahead and stop our on thread */
-	bridge->stop = 1;
-
 	return;
 }
 
@@ -540,9 +537,14 @@
 
 	ao2_lock(bridge);
 
-	bridge->stop = 1;
-
-	bridge_poke(bridge);
+	if (bridge->thread != AST_PTHREADT_NULL) {
+		pthread_t thread = bridge->thread;
+		bridge->stop = 1;
+		bridge_poke(bridge);
+		ao2_unlock(bridge);
+		pthread_join(thread, NULL);
+		ao2_lock(bridge);
+	}
 
 	ast_debug(1, "Telling all channels in bridge %p to end and leave the party\n", bridge);
 




More information about the asterisk-commits mailing list