本文整理汇总了PHP中Console::setProcessName方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::setProcessName方法的具体用法?PHP Console::setProcessName怎么用?PHP Console::setProcessName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::setProcessName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onStart
function onStart($serv, $worker_id = 0)
{
//用户修改
$server = $this->server->getConfig();
if (!empty($server['user'])) {
Console::changeUser($server['user']);
}
if (!empty($server['name'])) {
if ($worker_id >= $serv->setting['worker_num']) {
Console::setProcessName('php ' . $server['name'] . ': task');
} else {
Console::setProcessName('php ' . $server['name'] . ': worker');
}
}
Console::output($server['name'] . "[#{$worker_id}]. running. on {$server['host']}:{$server['port']}");
register_shutdown_function(array($this, 'onError'));
}
示例2: onWorkerStart
public function onWorkerStart($server, $workerId)
{
// echo __METHOD__;
// exit();
if ($workerId >= $this->setting['worker_num']) {
Console::setProcessName($this->processName . ': task worker process');
} else {
Console::setProcessName($this->processName . ': event worker process');
}
if ($this->user) {
Console::changeUser($this->user);
}
foreach ($this->requireFile as $v) {
include_once $v;
}
if ($this->serverClass && class_exists($this->serverClass)) {
$this->setProtocol(new $this->serverClass());
}
// check protocol class
if (!$this->protocol) {
throw new \Exception("[error] the protocol class " . $this->serverClass . " is empty or undefined");
}
$this->protocol->onStart($server, $workerId);
}
示例3: onWorkerStart
public function onWorkerStart($server, $workerId)
{
// echo __METHOD__;
// exit();
if ($workerId >= $this->setting['worker_num']) {
Console::setProcessName($this->processName . ': task worker process');
} else {
Console::setProcessName($this->processName . ': event worker process');
}
if ($this->user) {
Console::changeUser($this->user);
}
$protocol = (require_once $this->requireFile);
//执行
$this->setProtocol($protocol);
// check protocol class
if (!$this->protocol) {
throw new \Exception("[error] the protocol class is empty or undefined");
}
$this->protocol->onStart($server, $workerId);
}
示例4: onManagerStart
function onManagerStart($serv)
{
Console::setProcessName('php ' . $this->server['name'] . ': master -host=' . $this->server['host'] . ' -port=' . $this->server['port']);
}