mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-15 08:44:14 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@266877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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) {
|
if (new_technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD) {
|
||||||
ast_debug(1, "Telling current bridge thread for bridge %p to refresh\n", bridge);
|
ast_debug(1, "Telling current bridge thread for bridge %p to refresh\n", bridge);
|
||||||
bridge->refresh = 1;
|
bridge->refresh = 1;
|
||||||
|
bridge_poke(bridge);
|
||||||
} else {
|
} else {
|
||||||
|
pthread_t bridge_thread = bridge->thread;
|
||||||
ast_debug(1, "Telling current bridge thread for bridge %p to stop\n", bridge);
|
ast_debug(1, "Telling current bridge thread for bridge %p to stop\n", bridge);
|
||||||
bridge->stop = 1;
|
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 */
|
/* 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 */
|
||||||
|
Reference in New Issue
Block a user