本文整理汇总了PHP中swoole_process::name方法的典型用法代码示例。如果您正苦于以下问题:PHP swoole_process::name方法的具体用法?PHP swoole_process::name怎么用?PHP swoole_process::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swoole_process
的用法示例。
在下文中一共展示了swoole_process::name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback_process_function
function callback_process_function(swoole_process $worker)
{
set_time_limit(300);
$task = json_decode($worker->read(), true);
$worker->name('crontab.php worker=' . $task['uniqid']);
$Handle = new TimingCall_Handle($task);
$Handle->upNextExecuteTime();
$Handle->refreshStatistics();
$Handle->Execute();
$worker->exit(0);
}
示例2: child_async
function child_async(swoole_process $worker)
{
//echo "Worker: start. PID=".$worker->pid."\n";
//recv data from master
$GLOBALS['worker'] = $worker;
global $argv;
$worker->name("{$argv[0]}: worker");
swoole_process::signal(SIGTERM, function ($signal_num) use($worker) {
echo "signal call = {$signal_num}, #{$worker->pid}\n";
});
swoole_event_add($worker->pipe, function ($pipe) use($worker) {
$recv = $worker->read();
echo "From Master: {$recv}\n";
$worker->write("hello master\n");
});
}
示例3: function
function child_async(swoole_process $worker)
{
//echo "Worker: start. PID=".$worker->pid."\n";
global $argv;
$worker->name("{$argv[0]}: worker #" . $worker->id . "/" . $this->worker_num);
swoole_process::signal(SIGTERM, function ($signal_num) use($worker) {
echo "signal call = {$signal_num}, #{$worker->pid}\n";
});
switch ($this->status) {
case 'import':
echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
$this->import_data($worker);
break;
case '1-dim':
echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
$this->generate_1dim_rank($worker);
break;
case '2-dim':
echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
$this->generate_2dim_rank($worker);
break;
case '3-dim':
echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
$this->generate_3dim_rank($worker);
break;
default:
break;
}
$worker->exit(0);
}