OpenSwoole\Process::name ( string $name )

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Process::name ( string $name )

Parameters

name

New name of the process

Return

This method has been deprecated at the version v22.0.0. Use `OpenSwoole\Util::setProcessName()` instead.

Description

Set the name of the Swoole Process.

After the call of OpenSwoole\Process->call, the name will be resetted.

Example

<?php
$process = new OpenSwoole\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();
Last updated on January 19, 2023