posix_getpid
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return the current process identifier
posix_getpid
():
int
laravel/octane
public function
__invoke
(
$server
,
int $workerId
)
{
$this
->
workerState
->
workerId
=
$workerId
;
$this
->
workerState
->
workerPid
=
posix_getpid
();
$this
->
workerState
->
worker
=
$this
->
bootWorker
(
$server
);
$this
->
dispatchServerTickTaskEverySecond
(
$server
);
src/Swoole/Handlers/OnWorkerStart.php
reactphp/event-loop
});
$this
->
loop
->
futureTick
(function () {
posix_kill
(
posix_getpid
(),
SIGUSR1
);
});
$this
->
loop
->
run
();
tests/AbstractLoopTest.php
reactphp/event-loop
$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
) {
tests/AbstractLoopTest.php
reactphp/event-loop
protected function
forkSendSignal
(
$signal
)
{
$currentPid
=
posix_getpid
();
$childPid
=
pcntl_fork
();
if (
$childPid
== -
1
) {
$this
->
fail
(
"Failed to fork child process!"
);
tests/StreamSelectLoopTest.php
brefphp/bref
if (
$pid
===
posix_getpid
()) {
unlink
(
self
::
SOCKET
);
unlink
(
self
::
PID_FILE
);
return;
src/Event/Http/FpmHandler.php