summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_skinny.c2
-rw-r--r--pbx/pbx_dundi.c17
2 files changed, 14 insertions, 5 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index c7a718f35..70226766f 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -5125,7 +5125,7 @@ static int unload_module(void)
delete_devices();
ast_mutex_lock(&monlock);
- if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
+ if ((monitor_thread != AST_PTHREADT_NULL) && (monitor_thread != AST_PTHREADT_STOP)) {
pthread_cancel(monitor_thread);
pthread_kill(monitor_thread, SIGURG);
pthread_join(monitor_thread, NULL);
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);