summaryrefslogtreecommitdiff
path: root/pbx/pbx_dundi.c
diff options
context:
space:
mode:
Diffstat (limited to 'pbx/pbx_dundi.c')
-rw-r--r--pbx/pbx_dundi.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index f420ffb7d..e63f90397 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -2123,6 +2123,9 @@ static void *network_thread(void *ignore)
}
check_password();
}
+
+ netthreadid = AST_PTHREADT_NULL;
+
return NULL;
}
@@ -2158,6 +2161,8 @@ static void *process_precache(void *ign)
sleep(1);
}
+ precachethreadid = AST_PTHREADT_NULL;
+
return NULL;
}
@@ -4711,10 +4716,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);