title: php signal not handled right away
body: <p>I have a software written in PHP which can run for a long time, it's lauched via command line (not a web application).  I wanted to make sure to call a function when the software exit, including when killed via ctrl+c. When killed by a signal, the shutdown functions (destructors and functions registered via register_shutdown_fucntion() ) are not called.</p>
  
  <p>After some reading, I realized I had to add a handler on every relevant signal just to call "exit;". Doing so solved my problem and works.</p>
  
  <p>My issue is that in some case, the signal is not handled right away. It can take seconds, minutes and in some case, is not handled at all. Just like if the handler code was never reached.  I don't really know where to start to debug that. I've tried others signals (sigkill, sighup, etc), same behaviour.</p>
  
  <p>My code is withing these brackets </p>
  
  <pre><code>declare(ticks=1)
  {...}
  </code></pre>
  
  <p>I can't find any correlation between the time it get treated right away and the ones that it doesn't.</p>
  
  <p>Any help would be appreciated.</p>