1234567891011121314151617181920212223 |
- <?php
- namespace ln\listens;
- use ln\interfaces\ListenerInterface;
- use Swoole\Lock;
- class InitSwooleLockListen implements ListenerInterface
- {
- public function handle($event): void
- {
- $GLOBALS['_swoole_order_lock'] = [];
- $locks = array_merge(['default'], config('swoole.locks'));
- foreach ($locks as $lock) {
- $GLOBALS['_swoole_order_lock'][$lock] = new Lock(SWOOLE_MUTEX);
- }
- }
- }
|