Support Swow for hyperf/signal (#5070)

Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
Deeka Wong 2022-09-05 14:31:26 +08:00 committed by GitHub
parent 351b11d739
commit 781b0677dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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": {

View File

@ -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);