aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-09 14:49:05 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-09 14:49:05 +0000
commit432766bac595d4bf5ff06964679725153141efb2 (patch)
tree8db55c2787e9e886959347b020c3722dc8fe704d
parent5056b4e09f4cf02ca22ccc50d761f4ce5b657174 (diff)
Few minor thread synchronization tweaks. (issue #10124 reported by gzero)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@74045 f38db490-d61c-443f-a65b-d21fe96a405b
-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 bf642933e..1035517ba 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4778,7 +4778,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 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);