<p><a href="https://gerrit.asterisk.org/c/asterisk/+/10991">View Change</a></p><p>5 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10991/2/include/asterisk/sched.h">File include/asterisk/sched.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10991/2/include/asterisk/sched.h@84">Patch Set #2, Line 84:</a> <code style="font-family:monospace,monospace">                    usleep(1); \</code></p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">I do think it is bad if id changes while we are trying to delete the scheduled item.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Well indeed. If it changes, then all bets are off anyway. So I preferred my version for consistent behaviour.</p><p style="white-space: pre-wrap; word-wrap: break-word;">But I can certainly live with your version :)</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10991/2/main/sched.c">File main/sched.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10991/2/main/sched.c@121">Patch Set #2, Line 121:</a> <code style="font-family:monospace,monospace">       pthread_t currently_executing_on_thread_id;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">A better member name with doxygen: […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Done</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10991/2/main/sched.c@630">Patch Set #2, Line 630:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> } else if (con->currently_executing_on_thread_id == pthread_self()) {<br>              /* We might trample on deleted memory at this point. Not good,<br>                 * but it's better than a deadlock.<br>                * Thou shalt not reschedule things from a scheduled callback!<br>                 */<br>           ast_log(LOG_ERROR,<br>                    "BUG! Trying to delete sched %d from the same callback %p (sched %d). "<br>                     "Ignoring so we don't deadlock\n",<br>                      id, con->currently_executing->callback, con->currently_executing->sched_id->id);<br>               ast_log_backtrace();<br>          /* We'll return -1 below, because s is NULL. The caller<br>            * will rightly assume that the unscheduling failed. */<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">This is the wrong place for this check.  You are restricting a valid scenario. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Right. Fixing!</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10991/2/main/sched.c@642">Patch Set #2, Line 642:</a> <code style="font-family:monospace,monospace">        } else if (con->currently_executing && (id == con->currently_executing->sched_id->id)) {</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Within this if clause we have determined that we are trying to delete the scheduled item while it is […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">That is better indeed.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10991/2/main/sched.c@796">Patch Set #2, Line 796:</a> <code style="font-family:monospace,monospace">         con->currently_executing_on_thread_id = 0;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">This is not needed when the ast_sched_del() check is fixed.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Done</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/10991">change 10991</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/c/asterisk/+/10991"/><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-Change-Id: Ic26777fa0732725e6ca7010df17af77a012aa856 </div>
<div style="display:none"> Gerrit-Change-Number: 10991 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Walter Doekes <walter+asterisk@wjd.nu> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Walter Doekes <walter+asterisk@wjd.nu> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 17 Jul 2019 13:08:07 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>