mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-12 03:05:34 +08:00
set modules config to array add subdir index.html update Example of Hello.php add Exception tester for TimerMiddleware.php add keyword for @CQCommand rename OnWorkerStart.php to OnStart.php remove SwooleEventAfter.php rename HandleEvent.php to SwooleHandler.php set ZMRobot callback mode default to true add getNextArg() and getFullArg() add EventDispatcher.php logger set Exception all based from ZMException fix recursive bug for Response.php add single_bot_mode add SingletonTrait.php add bot() function
40 lines
795 B
PHP
40 lines
795 B
PHP
<?php
|
|
|
|
|
|
namespace ZM\Store;
|
|
|
|
|
|
use Swoole\Atomic;
|
|
use ZM\Config\ZMConfig;
|
|
|
|
class ZMAtomic
|
|
{
|
|
/** @var Atomic[] */
|
|
public static $atomics;
|
|
|
|
/**
|
|
* @param $name
|
|
* @return Atomic|null
|
|
*/
|
|
public static function get($name) {
|
|
return self::$atomics[$name] ?? null;
|
|
}
|
|
|
|
/**
|
|
* 初始化atomic计数器
|
|
*/
|
|
public static function init() {
|
|
foreach (ZMConfig::get("global", "init_atomics") as $k => $v) {
|
|
self::$atomics[$k] = new Atomic($v);
|
|
}
|
|
self::$atomics["stop_signal"] = new Atomic(0);
|
|
self::$atomics["wait_msg_id"] = new Atomic(0);
|
|
self::$atomics["_event_id"] = new Atomic(0);
|
|
for ($i = 0; $i < 10; ++$i) {
|
|
self::$atomics["_tmp_" . $i] = new Atomic(0);
|
|
}
|
|
}
|
|
|
|
|
|
}
|