[Asterisk-code-review] pbx dundi.c: Handle thread shutdown better. (asterisk[16])
Joshua Colp
asteriskteam at digium.com
Tue Aug 21 18:53:02 CDT 2018
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/9946 )
Change subject: pbx_dundi.c: Handle thread shutdown better.
......................................................................
pbx_dundi.c: Handle thread shutdown better.
Change-Id: Id52f99bd6a948fe6dd82acc0a28b2447a224fe87
---
M pbx/pbx_dundi.c
1 file changed, 12 insertions(+), 15 deletions(-)
Approvals:
Jenkins2: Verified
George Joseph: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index a94d71c..8245fa2 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -2198,7 +2198,6 @@
}
ast_io_remove(io, socket_read_id);
- netthreadid = AST_PTHREADT_NULL;
return NULL;
}
@@ -2233,7 +2232,6 @@
pthread_testcancel();
}
- clearcachethreadid = AST_PTHREADT_NULL;
return NULL;
}
@@ -2269,8 +2267,6 @@
sleep(1);
}
- precachethreadid = AST_PTHREADT_NULL;
-
return NULL;
}
@@ -4957,8 +4953,6 @@
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_unregister_switch(&dundi_switch);
ast_custom_function_unregister(&dundi_function);
@@ -4967,17 +4961,20 @@
/* Stop all currently running threads */
dundi_shutdown = 1;
- if (previous_netthreadid != AST_PTHREADT_NULL) {
- pthread_kill(previous_netthreadid, SIGURG);
- pthread_join(previous_netthreadid, NULL);
+ if (netthreadid != AST_PTHREADT_NULL) {
+ pthread_kill(netthreadid, SIGURG);
+ pthread_join(netthreadid, NULL);
+ netthreadid = AST_PTHREADT_NULL;
}
- if (previous_precachethreadid != AST_PTHREADT_NULL) {
- pthread_kill(previous_precachethreadid, SIGURG);
- pthread_join(previous_precachethreadid, NULL);
+ if (precachethreadid != AST_PTHREADT_NULL) {
+ pthread_kill(precachethreadid, SIGURG);
+ pthread_join(precachethreadid, NULL);
+ precachethreadid = AST_PTHREADT_NULL;
}
- if (previous_clearcachethreadid != AST_PTHREADT_NULL) {
- pthread_cancel(previous_clearcachethreadid);
- pthread_join(previous_clearcachethreadid, NULL);
+ if (clearcachethreadid != AST_PTHREADT_NULL) {
+ pthread_cancel(clearcachethreadid);
+ pthread_join(clearcachethreadid, NULL);
+ clearcachethreadid = AST_PTHREADT_NULL;
}
close(netsocket);
--
To view, visit https://gerrit.asterisk.org/9946
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: merged
Gerrit-Change-Id: Id52f99bd6a948fe6dd82acc0a28b2447a224fe87
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180821/da01965d/attachment.html>
More information about the asterisk-code-review
mailing list