This commit is contained in:
2023-04-01 23:57:36 +08:00
parent 881c1b3d49
commit d57c803a53
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ trait TraitServer
if (get_called_class() != CoroutineServer::class) {
pcntl_signal(SIGINT, [$this, 'onSigint']);
} else {
Coroutine::create(function () use ($signal, $callback) {
Coroutine::create(static function () use ($signal, $callback) {
$data = Coroutine::waitSignal($signal);
if ($data) {
$callback($signal, [true]);
+2 -2
View File
@@ -176,7 +176,7 @@ class CoroutineServer implements ServerInterface
$this->onTasker();
foreach ($this->servers as $server) {
Coroutine::create(function () use ($server) {
Coroutine::create(static function () use ($server) {
$server->start();
});
}
@@ -216,7 +216,7 @@ class CoroutineServer implements ServerInterface
$this->channel = new Coroutine\Channel($config[Constant::OPTION_TASK_WORKER_NUM]);
for ($i = 0; $i < $config[Constant::OPTION_TASK_WORKER_NUM]; $i++) {
Coroutine::create(fn() => $this->taskRunner($i, $taskEvents, $finishEvents));
Coroutine::create(static fn() => $this->taskRunner($i, $taskEvents, $finishEvents));
}
}