public function signal_handler_sigchild($signal_number)
	{
		// do not allow signals to interrupt this
		pcntl_async_signals(false);
		{
			// reap all child zombie processes
			if (self::$parent_pid == getmypid())
			{
				$status = '';

				do
				{
					// get child pid that exited
					$child_pid = pcntl_waitpid(0, $status, WNOHANG);
					if ($child_pid > 0)
					{
						// child exited
						$identifier = false;
						if (!isset($this->forked_children[$child_pid]))
						{
							$this->log("Cannot find $child_pid in array! (This may be a subprocess not in our fork)", self::LOG_LEVEL_INFO);
							continue;
						}

						$child = $this->forked_children[$child_pid];
						$identifier = $child['identifier'];

						// call exit function if and only if its declared */
						if ($child['status'] == self::WORKER)
						{
							$this->invoke_callback($this->parent_function_child_exited[ $this->forked_children[$child_pid]['bucket'] ], array($child_pid, $this->forked_children[$child_pid]['identifier']), true);
						}

						// stop the child pid
						$this->forked_children[$child_pid]['status'] = self::STOPPED;
						$this->forked_children_count--;

						// respawn helper processes
						if ($child['status'] == self::HELPER && $child['respawn'] === true)
						{
							$this->log('Helper process ' . $child_pid . ' died, respawning', self::LOG_LEVEL_INFO);
							$this->helper_process_spawn($child['function'], $child['arguments'], $child['identifier'], true);
						}

						// Poll for results from any children
						$this->post_results($child['bucket']);
					}
					elseif ($child_pid < 0)
					{
						// ignore acceptable error 'No child processes' given we force this signal to run potentially when no children exist
						if (pcntl_get_last_error() == 10)
						{
							continue;
						}

						// pcntl_wait got an error
						$this->log('pcntl_waitpid failed with error ' . pcntl_get_last_error() . ':' . pcntl_strerror((pcntl_get_last_error())), self::LOG_LEVEL_DEBUG);
					}
				} while ($child_pid > 0);
			}
		}
	}
public function signal_handler_sigchild($signal_number)
	{
		// do not allow signals to interrupt this
		pcntl_async_signals(false);
		{
			// reap all child zombie processes
			if (self::$parent_pid == getmypid())
			{
				$status = '';

				do
				{
					// get child pid that exited
					$child_pid = pcntl_waitpid(0, $status, WNOHANG);
					if ($child_pid > 0)
					{
						// child exited
						$identifier = false;
						if (!isset($this->forked_children[$child_pid]))
						{
							$this->log("Cannot find $child_pid in array! (This may be a subprocess not in our fork)", self::LOG_LEVEL_INFO);
							continue;
						}

						$child = $this->forked_children[$child_pid];
						$identifier = $child['identifier'];

						// call exit function if and only if its declared */
						if ($child['status'] == self::WORKER)
						{
							$this->invoke_callback($this->parent_function_child_exited[ $this->forked_children[$child_pid]['bucket'] ], array($child_pid, $this->forked_children[$child_pid]['identifier']), true);
						}

						// stop the child pid
						$this->forked_children[$child_pid]['status'] = self::STOPPED;
						$this->forked_children_count--;

						// respawn helper processes
						if ($child['status'] == self::HELPER && $child['respawn'] === true)
						{
							$this->log('Helper process ' . $child_pid . ' died, respawning', self::LOG_LEVEL_INFO);
							$this->helper_process_spawn($child['function'], $child['arguments'], $child['identifier'], true);
						}

						// Poll for results from any children
						$this->post_results($child['bucket']);
					}
					elseif ($child_pid < 0)
					{
						// ignore acceptable error 'No child processes' given we force this signal to run potentially when no children exist
						if (pcntl_get_last_error() == 10)
						{
							continue;
						}

						// pcntl_wait got an error
						$this->log('pcntl_waitpid failed with error ' . pcntl_get_last_error() . ':' . pcntl_strerror((pcntl_get_last_error())), self::LOG_LEVEL_DEBUG);
					}
				} while ($child_pid > 0);
			}
		}
	}
public function signal_handler_sigchild ( $ signal_number ) { // do not allow signals to interrupt this pcntl_async_signals ( false ) ; { // reap all child zombie processes if ( self :: $ parent_pid == getmypid ( ) ) { $ status = '' ; do { // get child pid that exited $ child_pid = pcntl_waitpid ( 0 , $ status , WNOHANG ) ; if ( $ child_pid > 0 ) { // child exited $ identifier = false ; if ( ! isset ( $ this -> forked_children [ $ child_pid ] ) ) { $ this -> log ( "Cannot find $child_pid in array! (This may be a subprocess not in our fork)" , self :: LOG_LEVEL_INFO ) ; continue ; } $ child = $ this -> forked_children [ $ child_pid ] ; $ identifier = $ child [ 'identifier' ] ; // call exit function if and only if its declared */ if ( $ child [ 'status' ] == self :: WORKER ) { $ this -> invoke_callback ( $ this -> parent_function_child_exited [ $ this -> forked_children [ $ child_pid ] [ 'bucket' ] ] , array ( $ child_pid , $ this -> forked_children [ $ child_pid ] [ 'identifier' ] ) , true ) ; } // stop the child pid $ this -> forked_children [ $ child_pid ] [ 'status' ] = self :: STOPPED ; $ this -> forked_children_count -- ; // respawn helper processes if ( $ child [ 'status' ] == self :: HELPER && $ child [ 'respawn' ] === true ) { $ this -> log ( 'Helper process ' . $ child_pid . ' died, respawning' , self :: LOG_LEVEL_INFO ) ; $ this -> helper_process_spawn ( $ child [ 'function' ] , $ child [ 'arguments' ] , $ child [ 'identifier' ] , true ) ; } // Poll for results from any children $ this -> post_results ( $ child [ 'bucket' ] ) ; } elseif ( $ child_pid < 0 ) { // ignore acceptable error 'No child processes' given we force this signal to run potentially when no children exist if ( pcntl_get_last_error ( ) == 10 ) { continue ; } // pcntl_wait got an error $ this -> log ( 'pcntl_waitpid failed with error ' . pcntl_get_last_error ( ) . ':' . pcntl_strerror ( ( pcntl_get_last_error ( ) ) ) , self :: LOG_LEVEL_DEBUG ) ; } } while ( $ child_pid > 0 ) ; } } }
Handle parent registered sigchild callbacks.

@param int $signal_number Is the signal that called this function.
@return void
@access public
@SuppressWarnings(PHPMD.UnusedFormalParameter) $signal_number is passed into all signal handlers.
Handle parent registered sigchild callbacks .