diff --git a/CHANGELOG-3.0.md b/CHANGELOG-3.0.md index bcb3f180b..64ed9fc45 100644 --- a/CHANGELOG-3.0.md +++ b/CHANGELOG-3.0.md @@ -123,6 +123,7 @@ composer analyse - [#4988](https://github.com/hyperf/hyperf/pull/4988) Support `hyperf/pool`. - [#4989](https://github.com/hyperf/hyperf/pull/4989) Support `hyperf/crontab`. - [#4990](https://github.com/hyperf/hyperf/pull/4990) Support `hyperf/nsq`. +- [#5070](https://github.com/hyperf/hyperf/pull/5070) Support `hyperf/signal`. ## Removed diff --git a/src/signal/composer.json b/src/signal/composer.json index ac8240af4..71fb24075 100644 --- a/src/signal/composer.json +++ b/src/signal/composer.json @@ -19,6 +19,7 @@ "php": ">=7.2", "psr/container": "^1.0|^2.0", "hyperf/contract": "~3.0.0", + "hyperf/engine": "^1.3|^2.0", "hyperf/utils": "~3.0.0" }, "autoload": { diff --git a/src/signal/src/SignalManager.php b/src/signal/src/SignalManager.php index dfc4d1eda..251f19293 100644 --- a/src/signal/src/SignalManager.php +++ b/src/signal/src/SignalManager.php @@ -13,12 +13,12 @@ namespace Hyperf\Signal; use Hyperf\Contract\ConfigInterface; use Hyperf\Di\Annotation\AnnotationCollector; +use Hyperf\Engine\Signal as EngineSignal; use Hyperf\Signal\Annotation\Signal; use Hyperf\Signal\SignalHandlerInterface as SignalHandler; use Hyperf\Utils\Coroutine; use Psr\Container\ContainerInterface; use SplPriorityQueue; -use Swoole\Coroutine\System; class SignalManager { @@ -65,7 +65,7 @@ class SignalManager foreach ($this->handlers[$process] ?? [] as $signal => $handlers) { Coroutine::create(function () use ($signal, $handlers) { while (true) { - $ret = System::waitSignal($signal, $this->config->get('signal.timeout', 5.0)); + $ret = EngineSignal::wait($signal, $this->config->get('signal.timeout', 5.0)); if ($ret) { foreach ($handlers as $handler) { $handler->handle($signal);