本文整理汇总了PHP中PHPDaemon\Core\Daemon::shm_wstate方法的典型用法代码示例。如果您正苦于以下问题:PHP Daemon::shm_wstate方法的具体用法?PHP Daemon::shm_wstate怎么用?PHP Daemon::shm_wstate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPDaemon\Core\Daemon
的用法示例。
在下文中一共展示了Daemon::shm_wstate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Performs initial actions.
* @return void
*/
public static function init()
{
Daemon::$startTime = time();
set_time_limit(0);
Daemon::$defaultErrorLevel = error_reporting();
Daemon::$restrictErrorControl = (bool) Daemon::$config->restricterrorcontrol->value;
ob_start(['\\PHPDaemon\\Core\\Daemon', 'outputFilter']);
set_error_handler(['\\PHPDaemon\\Core\\Daemon', 'errorHandler']);
Daemon::checkSupports();
Daemon::$initservervar = $_SERVER;
Daemon::$masters = new Collection();
Daemon::$shm_wstate = new ShmEntity(Daemon::$config->pidfile->value, Daemon::SHM_WSTATE_SIZE, 'wstate', true);
Daemon::openLogs();
}
示例2: init
//.........这里部分代码省略.........
}
}
if (isset(Daemon::$config->minspareworkers->value) && Daemon::$config->minspareworkers->value > 0 && isset(Daemon::$config->maxspareworkers->value) && Daemon::$config->maxspareworkers->value > 0) {
if (Daemon::$config->minspareworkers->value > Daemon::$config->maxspareworkers->value) {
Daemon::log('\'minspareworkers\' cannot be greater than \'maxspareworkers\'.');
$error = true;
}
}
if (isset(Daemon::$config->addincludepath->value)) {
ini_set('include_path', ini_get('include_path') . ':' . implode(':', Daemon::$config->addincludepath->value));
}
if (isset(Daemon::$config->minworkers->value) && isset(Daemon::$config->maxworkers->value)) {
if (Daemon::$config->minworkers->value > Daemon::$config->maxworkers->value) {
Daemon::$config->minworkers->value = Daemon::$config->maxworkers->value;
}
}
if ($runmode === 'start') {
if ($error === FALSE) {
Bootstrap::start();
} else {
exit(6);
}
} elseif ($runmode === 'runworker') {
if ($error === FALSE) {
Bootstrap::runworker();
} else {
exit(6);
}
} elseif ($runmode === 'status' || $runmode === 'fullstatus') {
$status = Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid);
echo '[STATUS] phpDaemon ' . Daemon::$version . ' is ' . ($status ? 'running' : 'NOT running') . ' (' . Daemon::$config->pidfile->value . ").\n";
if ($status && $runmode === 'fullstatus') {
echo 'Uptime: ' . DateTime::diffAsText(filemtime(Daemon::$config->pidfile->value), time()) . "\n";
Daemon::$shm_wstate = new ShmEntity(Daemon::$config->pidfile->value, Daemon::SHM_WSTATE_SIZE, 'wstate');
$stat = Daemon::getStateOfWorkers();
echo "State of workers:\n";
echo "\tTotal: " . $stat['alive'] . "\n";
echo "\tIdle: " . $stat['idle'] . "\n";
echo "\tBusy: " . $stat['busy'] . "\n";
echo "\tShutdown: " . $stat['shutdown'] . "\n";
echo "\tPre-init: " . $stat['preinit'] . "\n";
echo "\tInit: " . $stat['init'] . "\n";
}
echo "\n";
} elseif ($runmode === 'update') {
if (!Bootstrap::$pid || !posix_kill(Bootstrap::$pid, SIGHUP)) {
echo '[UPDATE] ERROR. It seems that phpDaemon is not running' . (Bootstrap::$pid ? ' (PID ' . Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode === 'reopenlog') {
if (!Bootstrap::$pid || !posix_kill(Bootstrap::$pid, SIGUSR1)) {
echo '[REOPEN-LOG] ERROR. It seems that phpDaemon is not running' . (Bootstrap::$pid ? ' (PID ' . Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode === 'reload') {
if (!Bootstrap::$pid || !posix_kill(Bootstrap::$pid, SIGUSR2)) {
echo '[RELOAD] ERROR. It seems that phpDaemon is not running' . (Bootstrap::$pid ? ' (PID ' . Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode === 'restart') {
if ($error === FALSE) {
Bootstrap::stop(2);
Bootstrap::start();
}
} elseif ($runmode === 'hardrestart') {
Bootstrap::stop(3);
Bootstrap::start();
} elseif ($runmode === 'ipcpath') {
$i = Daemon::$appResolver->getInstanceByAppName('\\PHPDaemon\\IPCManager\\IPCManager');