<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9948">View Change</a></p><div style="white-space:pre-wrap">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
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx_dundi.c: Handle thread shutdown better.<br><br>Change-Id: Id52f99bd6a948fe6dd82acc0a28b2447a224fe87<br>---<br>M pbx/pbx_dundi.c<br>1 file changed, 12 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c</span><br><span>index c8ddffb..19a26cd 100644</span><br><span>--- a/pbx/pbx_dundi.c</span><br><span>+++ b/pbx/pbx_dundi.c</span><br><span>@@ -2200,7 +2200,6 @@</span><br><span> }</span><br><span> </span><br><span> ast_io_remove(io, socket_read_id);</span><br><span style="color: hsl(0, 100%, 40%);">- netthreadid = AST_PTHREADT_NULL;</span><br><span> </span><br><span> return NULL;</span><br><span> }</span><br><span>@@ -2235,7 +2234,6 @@</span><br><span> pthread_testcancel();</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- clearcachethreadid = AST_PTHREADT_NULL;</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span>@@ -2271,8 +2269,6 @@</span><br><span> sleep(1);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- precachethreadid = AST_PTHREADT_NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span>@@ -4959,8 +4955,6 @@</span><br><span> </span><br><span> static int unload_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_t previous_netthreadid = netthreadid, previous_precachethreadid = precachethreadid, previous_clearcachethreadid = clearcachethreadid;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> ast_cli_unregister_multiple(cli_dundi, ARRAY_LEN(cli_dundi));</span><br><span> ast_unregister_switch(&dundi_switch);</span><br><span> ast_custom_function_unregister(&dundi_function);</span><br><span>@@ -4969,17 +4963,20 @@</span><br><span> </span><br><span> /* Stop all currently running threads */</span><br><span> dundi_shutdown = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- if (previous_netthreadid != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_kill(previous_netthreadid, SIGURG);</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_join(previous_netthreadid, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (netthreadid != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_kill(netthreadid, SIGURG);</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_join(netthreadid, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ netthreadid = AST_PTHREADT_NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (previous_precachethreadid != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_kill(previous_precachethreadid, SIGURG);</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_join(previous_precachethreadid, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (precachethreadid != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_kill(precachethreadid, SIGURG);</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_join(precachethreadid, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ precachethreadid = AST_PTHREADT_NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (previous_clearcachethreadid != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_cancel(previous_clearcachethreadid);</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_join(previous_clearcachethreadid, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (clearcachethreadid != AST_PTHREADT_NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_cancel(clearcachethreadid);</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_join(clearcachethreadid, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ clearcachethreadid = AST_PTHREADT_NULL;</span><br><span> }</span><br><span> </span><br><span> close(netsocket);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9948">change 9948</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9948"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id52f99bd6a948fe6dd82acc0a28b2447a224fe87 </div>
<div style="display:none"> Gerrit-Change-Number: 9948 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>