summaryrefslogtreecommitdiff
path: root/pbx/pbx_dundi.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-07-09 14:50:04 +0000
committerJoshua Colp <jcolp@digium.com>2007-07-09 14:50:04 +0000
commit836ea36d3c436960c67684211277016f705187a2 (patch)
tree5064c6b9d8edbd58e83db0aeb8071b54cf5a98ff /pbx/pbx_dundi.c
parenta9ab6620f1cb92824a86208f8c711ccdb8454f00 (diff)
Merged revisions 74045 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r74045 | file | 2007-07-09 11:49:05 -0300 (Mon, 09 Jul 2007) | 2 lines Few minor thread synchronization tweaks. (issue #10124 reported by gzero) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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);