src/Process/handler/SignalHandler.php
private function shutdown($signal = 9)
    {
        // Iterate through all the existing processes, and send the appropriate signal to the process
        foreach ($this->dispatcher->getProcesses() as $pid => $process) {
            $this->logger->debug('Sending signal to process', [
                'signal' => $signal,
                'pid' => $pid,
                'jobId' => $process['id'],
                'queue' => $this->queue->getName()
            ]);

            /**
             * $process['process']->signal($signal)
             * Amp\Process\Process::signal doesn't actually send signals correctly, and is not cross platform
             * Use posix_kill to actually send the signal to the process for handling
             */
            \posix_kill($pid, $signal);

            // If a signal other than SIGKILL was sent to the process, create a deadline timeout and force kill the process if it's still alive after the deadline
            if ($signal !== 9) {
                if ($this->config['deadline_timeout'] !== null) {
                    Loop::delay(((int)$this->config['deadline_timeout'] * 1000), function ($watcherId, $callback) use ($process, $pid) {
                        if ($process['process']->isRunning()) {
                            $this->logger->info('Process has exceeded deadline timeout. Killing', [
                                'pid' => $pid,
                                'jobId' => $process['id'],
                                'queue' => $this->queue->getName()
                            ]);

                            // Send SIGKILL to the process
                            \posix_kill($pid, SIGKILL);
                        }
                    });
                }
            }
        }
    }
private function shutdown($signal = 9)
    {
        // Iterate through all the existing processes, and send the appropriate signal to the process
        foreach ($this->dispatcher->getProcesses() as $pid => $process) {
            $this->logger->debug('Sending signal to process', [
                'signal' => $signal,
                'pid' => $pid,
                'jobId' => $process['id'],
                'queue' => $this->queue->getName()
            ]);

            /**
             * $process['process']->signal($signal)
             * Amp\Process\Process::signal doesn't actually send signals correctly, and is not cross platform
             * Use posix_kill to actually send the signal to the process for handling
             */
            \posix_kill($pid, $signal);

            // If a signal other than SIGKILL was sent to the process, create a deadline timeout and force kill the process if it's still alive after the deadline
            if ($signal !== 9) {
                if ($this->config['deadline_timeout'] !== null) {
                    Loop::delay(((int)$this->config['deadline_timeout'] * 1000), function ($watcherId, $callback) use ($process, $pid) {
                        if ($process['process']->isRunning()) {
                            $this->logger->info('Process has exceeded deadline timeout. Killing', [
                                'pid' => $pid,
                                'jobId' => $process['id'],
                                'queue' => $this->queue->getName()
                            ]);

                            // Send SIGKILL to the process
                            \posix_kill($pid, SIGKILL);
                        }
                    });
                }
            }
        }
    }
Interal shutdown function

@param integer $signal
@return void