This commit is contained in:
as2252258@163.com
2021-02-28 00:31:07 +08:00
parent bfba2aa965
commit 2ac21328f6
+8 -12
View File
@@ -68,18 +68,14 @@ class OnWorkerStart extends Callback
public function onSignal($server, $worker_id) public function onSignal($server, $worker_id)
{ {
$this->debug(sprintf(workerName($worker_id) . ' #%d is start.....', $worker_id)); $this->debug(sprintf(workerName($worker_id) . ' #%d is start.....', $worker_id));
Coroutine\go(function (Server $server, $worker_id) { // Coroutine\go(function (Server $server, $worker_id) {
$sigkill = Coroutine::waitSignal($this->signal); Coroutine::waitSignal($this->signal);
if ($sigkill === false) { while (Co::stats()['coroutine_num'] > 0) {
return $server->stop($worker_id, true); var_dump(Co::stats()['coroutine_num']);
} Coroutine::sleep(0.01);
while (Co::stats()['coroutine_num'] > 0) { }
var_dump(Co::stats()['coroutine_num']); return $server->stop($worker_id, true);
Coroutine::sleep(0.01); // }, $server, $worker_id);
}
return $server->stop($worker_id, true);
}, $server, $worker_id);
} }