mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Support Swow for hyperf/signal (#5070)
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
parent
351b11d739
commit
781b0677dc
@ -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
|
||||
|
||||
|
@ -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": {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user