title: pcntl_wait not interrupted by SIGTERM
body: <p>According to the PHP docs for <a href="http://www.php.net/manual/en/function.pcntl-wait.php" rel="noreferrer">pcntl_wait</a>,</p>
  
  <blockquote>
    <p>The wait function suspends execution of the current process until a child has exited, or until a signal is delivered whose action is to terminate the current process or to call a signal handling function.</p>
  </blockquote>
  
  <p>However, when I run the following code and send SIGTERM to the parent process with <code>kill -s SIGTERM [pid]</code> the signal handler is only called <em>after</em> the child exits (i.e. I have to wait for the sleep to finish. Shouldn't <code>pcntl_wait()</code> be interrupted by SIGTERM?</p>
  
  <p>fork_test.php:</p>
  
  <pre><code>&lt;?php
    declare(ticks = 1);
  
    function sig_handler($signo) {
      switch ($signo) {
        case SIGTERM:
          echo 'SIGTERM' . PHP_EOL;
          break;
        default:
      }
    }
  
    pcntl_signal(SIGTERM, 'sig_handler');
  
    $pid = pcntl_fork();
  
    if ($pid == -1) {
       die('could not fork');
    }
    else if ($pid) {
      echo 'parent' . PHP_EOL;
  
      pcntl_wait($status);
    }
    else {
      echo 'child' . PHP_EOL;
      sleep(30);
    }
  ?&gt;
  </code></pre>
  
  <p>Output (SIGTERM only appears after waiting 30 seconds):</p>
  
  <pre><code>$ php fork_test.php
  child
  parent
  SIGTERM
  </code></pre>
  
  <p><strong>PHP Version => 5.3.3</strong></p>