Package: asterisk / 1:1.6.2.9-2+squeeze12

fix_bridging_crash Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Paul Belanger <paul.belanger@polybeacon.com>
Date: Wed, 2 Jun 2010 13:34:09 +0000
Subject: pthread_join to assure the thread is really gone
Bug: https://issues.asterisk.org/view.php?id=15465
Origin: http://svnview.digium.com/svn/asterisk?view=rev&rev=266878
Bug-Debian: http://bugs.debian.org/639821

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

---
 main/bridging.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/main/bridging.c b/main/bridging.c
index 2f5afa2..e034543 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -626,11 +626,16 @@ static int smart_bridge_operation(struct ast_bridge *bridge, struct ast_bridge_c
 		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);
+			ao2_unlock(bridge);
+			pthread_join(bridge_thread, NULL);
+			ao2_lock(bridge);
 		}
-		bridge_poke(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 */
-- 
1.7.6.3