Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
<?php Swoole\Process::name ( string $name )
New name of the process
Set the name of the Swoole Process.
After the call of Swoole\Process->call
, the name will be resetted.
<?php
$process = new Swoole\Process(function($worker){
echo "the pid of child process is " . $worker->pid . "\n";
echo "the file descriptor of pipe is " . $worker->pipe . "\n";
$worker->write("Hello main process\n");
$worker->name("php child process"); // set name of the process
sleep(100);
}, FALSE, 1);
$process->start();
usleep(100);
echo $process->read();