<table><tr><td style="">rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D16218">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">Arguably that still stands, but it's outside my area of expertise to comment on it.</pre></div></blockquote>
<p>FWIW, I took Kevin's remark about this as a reaction to the fact that I moved the signal handling stuff into the CorePrivate class, and a request to take it back out as it was before. I think his other remarks in the exchange we had mean that he didn't intend me to write a dedicated signal handling class. I still could of course, but is it really worth the effort given that there's unlikely to be reuse and the only reason to instantiate the class would be to have a target to connect to?</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>core.cpp:103<br />
+ write(signalPipeWrite, &sig, sizeof(sig));<br />
+ }<br />
+}</p></blockquote>
<p>Maybe you can add an else branch where you re-raise the signal with the default handler.</p></blockquote>
<p>If the goal is just to let a 2nd signal trigger the default reaction from the runtime then it can be even simpler. No need for an else, a <tt style="background: #ebebeb; font-size: 13px;">signal(sig, SIG_DFL)</tt> after that write() would do the same thing.<br />
But remember there was a 2nd aspect to this patch initially which I've been told to submit in a separate patch: handle SIGHUP with a more basic shutdown method, the same as used in case a second signal is handled.</p>
<p>Of course that could also be done in a different way: connect the QSocketNotifier signal to a different slot ("shutDownSafelyNow()") before attempting the graceful exit (and call that slot when a SIGHUP arrives):</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">shutDownSafelyNow()
{
std::signal(sig, SIG_DFL);
if (corePrivateInstance->m_core) {
// shutdown core functionality, in particular the DUChain subsystem
// in an effort to prevent cache corruption. It's only cache, but
// regenerating it can be very time-consuming.
corePrivateInstance->m_core->shutdown();
}
signalNotifier->setEnabled(false);
// re-raise signal with default handler and trigger program termination
std::raise(sig);
}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16218">https://phabricator.kde.org/D16218</a></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop, kfunk, aaronpuchert<br /><strong>Cc: </strong>aaronpuchert, brauch, kfunk, arrowd, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight<br /></div>