From: Joshua Colp Date: Tue, 21 Aug 2018 23:53:06 +0000 (-0500) Subject: Merge "pbx_dundi.c: Handle thread shutdown better." into 13 X-Git-Tag: 13.23.0-rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cb87da69ca6577a9bdd24ec0309e5ccaeb35f57;p=thirdparty%2Fasterisk.git Merge "pbx_dundi.c: Handle thread shutdown better." into 13 --- 1cb87da69ca6577a9bdd24ec0309e5ccaeb35f57 diff --cc pbx/pbx_dundi.c index ca86dcf0c8,19a26cd33c..bbcae06315 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@@ -4998,19 -4963,25 +4992,22 @@@ static int unload_module(void /* Stop all currently running threads */ dundi_shutdown = 1; - if (previous_netthreadid != AST_PTHREADT_NULL) { - pthread_kill(previous_netthreadid, SIGURG); - pthread_join(previous_netthreadid, NULL); - } - if (previous_precachethreadid != AST_PTHREADT_NULL) { - pthread_kill(previous_precachethreadid, SIGURG); - pthread_join(previous_precachethreadid, NULL); - } - if (previous_clearcachethreadid != AST_PTHREADT_NULL) { - pthread_cancel(previous_clearcachethreadid); - pthread_join(previous_clearcachethreadid, NULL); + if (netthreadid != AST_PTHREADT_NULL) { + pthread_kill(netthreadid, SIGURG); + pthread_join(netthreadid, NULL); + netthreadid = AST_PTHREADT_NULL; + } + if (precachethreadid != AST_PTHREADT_NULL) { + pthread_kill(precachethreadid, SIGURG); + pthread_join(precachethreadid, NULL); + precachethreadid = AST_PTHREADT_NULL; + } + if (clearcachethreadid != AST_PTHREADT_NULL) { + pthread_cancel(clearcachethreadid); + pthread_join(clearcachethreadid, NULL); + clearcachethreadid = AST_PTHREADT_NULL; } - close(netsocket); - io_context_destroy(io); - mark_mappings(); prune_mappings(); mark_peers();