pcntl_fork
Supported Versions: PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8
Forks the currently running process
pcntl_fork
():
int
laravel/framework
posix_setpgid
(
0
,
0
);
for (
$i
=
1
;
$i
<=
20
;
$i
++) {
$pid
=
pcntl_fork
();
if (!
$pid
) {
$files
= new
Filesystem
;
tests/Filesystem/FilesystemTest.php
laravel/framework
{
$this
->
tearDownRedis
();
if (
$pid
=
pcntl_fork
() >
0
) {
$this
->
setUpRedis
();
$this
->
setQueue
(
$driver
,
'default'
,
null
,
60
,
10
);
$this
->
assertEquals
(
12
,
unserialize
(
json_decode
(
$this
->
queue
->
pop
()->
getRawBody
())->
data
->
command
)->
i
);
tests/Queue/RedisQueueIntegrationTest.php
spatie/fork
{
[
$socketToParent
,
$socketToChild
] =
Connection
::
createPair
();
$processId
=
pcntl_fork
();
if (
$this
->
currentlyInChildTask
(
$processId
)) {
$socketToChild
->
close
();
src/Fork.php
reactphp/event-loop
protected function
forkSendSignal
(
$signal
)
{
$currentPid
=
posix_getpid
();
$childPid
=
pcntl_fork
();
if (
$childPid
== -
1
) {
$this
->
fail
(
"Failed to fork child process!"
);
} else if (
$childPid
===
0
) {
tests/StreamSelectLoopTest.php