mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 19:28:53 +00:00
pbx_dundi.c: Handle thread shutdown better.
Change-Id: Id52f99bd6a948fe6dd82acc0a28b2447a224fe87
This commit is contained in:
@@ -2198,7 +2198,6 @@ static void *network_thread(void *ignore)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ast_io_remove(io, socket_read_id);
|
ast_io_remove(io, socket_read_id);
|
||||||
netthreadid = AST_PTHREADT_NULL;
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -2233,7 +2232,6 @@ static void *process_clearcache(void *ignore)
|
|||||||
pthread_testcancel();
|
pthread_testcancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearcachethreadid = AST_PTHREADT_NULL;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2269,8 +2267,6 @@ static void *process_precache(void *ign)
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
precachethreadid = AST_PTHREADT_NULL;
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4957,8 +4953,6 @@ static int set_config(char *config_file, struct sockaddr_in* sin, int reload)
|
|||||||
|
|
||||||
static int unload_module(void)
|
static int unload_module(void)
|
||||||
{
|
{
|
||||||
pthread_t previous_netthreadid = netthreadid, previous_precachethreadid = precachethreadid, previous_clearcachethreadid = clearcachethreadid;
|
|
||||||
|
|
||||||
ast_cli_unregister_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
|
ast_cli_unregister_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
|
||||||
ast_unregister_switch(&dundi_switch);
|
ast_unregister_switch(&dundi_switch);
|
||||||
ast_custom_function_unregister(&dundi_function);
|
ast_custom_function_unregister(&dundi_function);
|
||||||
@@ -4967,17 +4961,20 @@ static int unload_module(void)
|
|||||||
|
|
||||||
/* Stop all currently running threads */
|
/* Stop all currently running threads */
|
||||||
dundi_shutdown = 1;
|
dundi_shutdown = 1;
|
||||||
if (previous_netthreadid != AST_PTHREADT_NULL) {
|
if (netthreadid != AST_PTHREADT_NULL) {
|
||||||
pthread_kill(previous_netthreadid, SIGURG);
|
pthread_kill(netthreadid, SIGURG);
|
||||||
pthread_join(previous_netthreadid, NULL);
|
pthread_join(netthreadid, NULL);
|
||||||
|
netthreadid = AST_PTHREADT_NULL;
|
||||||
}
|
}
|
||||||
if (previous_precachethreadid != AST_PTHREADT_NULL) {
|
if (precachethreadid != AST_PTHREADT_NULL) {
|
||||||
pthread_kill(previous_precachethreadid, SIGURG);
|
pthread_kill(precachethreadid, SIGURG);
|
||||||
pthread_join(previous_precachethreadid, NULL);
|
pthread_join(precachethreadid, NULL);
|
||||||
|
precachethreadid = AST_PTHREADT_NULL;
|
||||||
}
|
}
|
||||||
if (previous_clearcachethreadid != AST_PTHREADT_NULL) {
|
if (clearcachethreadid != AST_PTHREADT_NULL) {
|
||||||
pthread_cancel(previous_clearcachethreadid);
|
pthread_cancel(clearcachethreadid);
|
||||||
pthread_join(previous_clearcachethreadid, NULL);
|
pthread_join(clearcachethreadid, NULL);
|
||||||
|
clearcachethreadid = AST_PTHREADT_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(netsocket);
|
close(netsocket);
|
||||||
|
Reference in New Issue
Block a user