Sends a signal to the process, this method prevents the signal from being sent twice

@return void
338416
private function sendTERMSignal()
    {
        if (!$this->hasReceivedHUP) {
            $this->hasReceivedHUP = true;
            try {
                $this->process->signal(SIGTERM);
            } catch (\Symfony\Component\Process\Exception\LogicException $e) {
                //In case the process ends between checking and actually sending the signal
            }
        }
    }
1354196
public static function signal($signals, $callback)
    {
        foreach ($signals as $signal) {
            if (is_null($callback)) {
                \Swoole\Process::signal($signal, null);
                continue;
            }
            \Swoole\Process::signal($signal, function ($signal) use ($callback) {
                try {
                    call_user_func($callback, $signal);
                } catch (\Throwable $e) {
                    \Mix::$app->error->handleException($e);
                }
            });
        }
    }
323552
protected function sendSignal($signalNumber)
    {
        if (! $this->context->isRunning || ! $this->context->processId) {
            return false;
        }

        $result = $this->control->signal()->send($signalNumber, $this->context->processId);
        if (in_array($signalNumber, [SIGTERM, SIGKILL])) {
            $this->context->isRunning = false;
            $this->context->processId = null;
        }

        return $result;
    }
162089
public function stop( $_signal = SIGKILL, $_wait = false ) {
		if( $this->isAlive() ) {
			posix_kill( $this->pid, $_signal );
			if( $_wait ) {
				pcntl_waitpid( $this->pid, $status = 0 );
			}
		}
	}
74722
public function send()
    {
        $args = func_get_args();
        if (count($args) > 1) {
            $message = call_user_func_array('sprintf', $args);
        } else {
            $message = $args[0];
        }
        $this->response->send($message);
    }
500786
public function send()
    {
        foreach ($this->headers as $header) {
            header($header->getString(), $header->getReplace(), $header->getHttpResponseCode());
        }
    }
1229173
public function send()
    {
        $this->sendContentOptions();
        $this->sendFrameOptions();
        $this->sendXssProtection();
        $this->sendStrictTransport();
        $this->sendAccessControlAllowOrigin();
        $this->sendContentSecurity();
    }
864931
public function send()
    {
        if (!$this->_error) {
            foreach ($this->_headers as $value) {
                header($value);
            }//end foreach
            header('N5_RAND_TOKEN: '.$GLOBALS['app']->getSessionManager()->getActiveSession()->getAttribute('nonce'));
            echo $this->_transform($this->_encoding, $this->_body);
        }
    }
795824
public function emit(Signal $signal)
    {
        if ($this->transactionDepth === 0) {
            $this->signalDispatcher->emit($signal);
        } else {
            $this->signalsQueue[$this->transactionCount][] = $signal;
        }
    }
205445
private function sendDisconnect()
    {
        if(!$this->socket || feof($this->socket))
            return;

        $payload = chr(0xe0).chr(0x00);
        fwrite($this->socket, $payload, 2);

        $this->debugMessage("DISCONNECT sent");
    }
1315009
public function sendSignal(int $signal) {
        $runningPid = $this->lock->getRunningPID();
        if (!$runningPid) {
            return false;
        }

        // Send signal
        return posix_kill($runningPid, $signal);
    }
72788
public function send()
  {
    foreach($this->headers as $header) {
      header($header);
    }

    $response = array();

    if ($this->message != null) {
      $response = $this->message;
    } elseif ($this->data != []) {
      $response = array_merge($response, $this->data);
    }

    if (is_array($response)) {
      echo json_encode($response);
      return;
    }

    echo $response;
  }
529273
public function process(): void
    {
        $this->queue = msg_get_queue(ftok(__DIR__.DIRECTORY_SEPARATOR.'Queue.php', 't'));
        $this->catchSignal();
        $this->spawnInitialWorkers();
        $this->main();
    }
571180
public function handleSignal($signal)
    {
        if (in_array($signal, $this->stopSignals)) {
            $this->logger->info(sprintf('Handle stop signal (%s)', $signal));
            $this->stop = true;
        } elseif (in_array($signal, $this->pauseSignals)) {
            $this->logger->info(sprintf('Handle pause signal (%s)', $signal));
            $this->pause = true;
        } elseif (in_array($signal, $this->resumeSignals)) {
            $this->logger->info(sprintf('Handle resume signal (%s)', $signal));
            $this->pause = false;
        }
    }
539415
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ObjectStateService\CreateObjectStateSignal) {
            return;
        }

        parent::receive($signal);
    }
1374983
public function shutdown($signal = SIGTERM)
    {
        foreach ($this->processes as $process) {
            if ($process->isRunning()) {
                $process->shutdown(true, $signal);
            }
        }
    }
170169
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\CopyContentSignal) {
            return;
        }

        $this->client->updateContent($signal->dstContentId, $signal->dstVersionNo);
    }