本文整理匯總了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);
}