<p>Patch set 2:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/10293">View Change</a></p><p>11 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10293/2/include/asterisk/lock.h">File include/asterisk/lock.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/10293/2/include/asterisk/lock.h@144">Patch Set #2, Line 144:</a> <code style="font-family:monospace,monospace">#elif defined(DEBUG_THREADS) || !defined(DEBUG_THREADS_LOOSE_ABI)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">You don't need to test DEBUG_THREADS_LOOSE_ABI here.</p><p style="white-space: pre-wrap; word-wrap: break-word;">If DEBUG_THREADS is enabled you need to have these members everywhere.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/include/asterisk/lock.h@158">Patch Set #2, Line 158:</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;">#if defined(DEBUG_THREADS) || !defined(DEBUG_THREADS_LOOSE_ABI)<br> /*! Track which thread holds this lock */<br> struct ast_lock_track *track;<br> struct ast_lock_track_flags flags;<br>#endif<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">You should be able to do the same conditionals here as for ast_mutex_info.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c">File main/lock.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/10293/2/main/lock.c@81">Patch Set #2, Line 81:</a> <code style="font-family:monospace,monospace"> if (no_setup || !flags->tracking || flags->setup) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">To be safer, we should test no_setup after we get the reentrancy lock.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@87">Patch Set #2, Line 87:</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;"> if (*plt) {<br> pthread_mutex_unlock(&reentrancy_lock.mutex);<br> return *plt;<br> }<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This should be safer concerning the pointer we return when no_setup is set because we are destroying the lock. We would only get this far if the lock was not already setup when we are destroying the lock.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">if (*plt) {<br> pthread_mutex_unlock(&reentrancy_lock.mutex);<br> return *plt;<br>}<br>if (no_setup) {<br> pthread_mutex_unlock(&reentrancy_lock.mutex);<br> return NULL;<br>}</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@147">Patch Set #2, Line 147:</a> <code style="font-family:monospace,monospace"> t->flags.tracking = tracking;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Should also set t->flags.setup = 0;</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@356">Patch Set #2, Line 356:</a> <code style="font-family:monospace,monospace"> int canlog = lt && strcmp(filename, "logger.c");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">canlog is not used</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@670">Patch Set #2, Line 670:</a> <code style="font-family:monospace,monospace"> t->flags.tracking = tracking;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Should also set t->flags.setup = 0;</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@689">Patch Set #2, Line 689:</a> <code style="font-family:monospace,monospace"> int canlog = lt && strcmp(filename, "logger.c");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">canlog not used</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@736">Patch Set #2, Line 736:</a> <code style="font-family:monospace,monospace"> int canlog = t->flags.tracking && strcmp(filename, "logger.c");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">canlog not used</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@1003">Patch Set #2, Line 1003:</a> <code style="font-family:monospace,monospace"> int canlog = lt && strcmp(filename, "logger.c");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">canlog not used</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10293/2/main/lock.c@1085">Patch Set #2, Line 1085:</a> <code style="font-family:monospace,monospace"> int canlog = lt && strcmp(filename, "logger.c");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">canlog not used</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10293">change 10293</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/10293"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b </div>
<div style="display:none"> Gerrit-Change-Number: 10293 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 28 Sep 2018 17:10:09 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>