posix_getpid

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return the current process identifier
posix_getpid(): int
    public function __invoke($serverint $workerId)

    {

        
$this->workerState->workerId $workerId;

        
$this->workerState->workerPid posix_getpid();

        
$this->workerState->worker $this->bootWorker($server);



        
$this->dispatchServerTickTaskEverySecond($server);
        });



        
$this->loop->futureTick(function () {

            
posix_kill(posix_getpid(), SIGUSR1);

        });



        
$this->loop->run();
        $this->loop->addSignal(SIGUSR1$func);



        
$this->loop->addTimer(0.4, function () {

            
posix_kill(posix_getpid(), SIGUSR1);

        });

        
$loop $this->loop;

        
$this->loop->addTimer(0.9, function () use (&$func$loop) {
    protected function forkSendSignal($signal)

    {

        
$currentPid posix_getpid();

        
$childPid pcntl_fork();

        if (
$childPid == -1) {

            
$this->fail("Failed to fork child process!");
        if ($pid === posix_getpid()) {

            
unlink(self::SOCKET);

            
unlink(self::PID_FILE);

            return;