aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorpabelanger <pabelanger@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-02 13:32:22 +0000
committerpabelanger <pabelanger@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-02 13:32:22 +0000
commitb988f37ebc56d5a8dc6f95b7477da4e2efc3a3b0 (patch)
treea53447b46cc6d71525b8a9d1552d4c1089756584 /main
parent4062148a0754ad4e60b881df1fd10b83c1c32d45 (diff)
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/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266877 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/bridging.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/bridging.c b/main/bridging.c
index 6c2a66804..a256cf038 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -635,11 +635,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 */