diff options
Diffstat (limited to 'pbx/pbx_dundi.c')
-rw-r--r-- | pbx/pbx_dundi.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 02e900dca..7f13a7f78 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2093,6 +2093,9 @@ static void *network_thread(void *ignore) } check_password(); } + + netthreadid = AST_PTHREADT_NULL; + return NULL; } @@ -2128,6 +2131,8 @@ static void *process_precache(void *ign) sleep(1); } + precachethreadid = AST_PTHREADT_NULL; + return NULL; } @@ -4467,10 +4472,14 @@ static int unload_module(void) /* Stop all currently running threads */ dundi_shutdown = 1; - pthread_kill(netthreadid, SIGURG); - pthread_join(netthreadid, NULL); - pthread_kill(precachethreadid, SIGURG); - pthread_join(precachethreadid, NULL); + if (netthreadid != AST_PTHREADT_NULL) { + pthread_kill(netthreadid, SIGURG); + pthread_join(netthreadid, NULL); + } + if (precachethreadid != AST_PTHREADT_NULL) { + pthread_kill(precachethreadid, SIGURG); + pthread_join(precachethreadid, NULL); + } ast_cli_unregister_multiple(cli_dundi, sizeof(cli_dundi) / sizeof(struct ast_cli_entry)); ast_unregister_switch(&dundi_switch); |