posix_getpid

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

    {

        $this->workerState->workerId = $workerId;

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

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



        $this->dispatchServerTickTaskEverySecond($server);
<?php         });



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

            posix_kill(posix_getpid(), SIGUSR1);

        });



        $this->loop->run();
<?php         $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) {
<?php     protected function forkSendSignal($signal)

    {

        $currentPid = posix_getpid();

        $childPid = pcntl_fork();

        if ($childPid == -1) {

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

            unlink(self::SOCKET);

            unlink(self::PID_FILE);

            return;