变更
This commit is contained in:
@@ -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
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user