mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-19 09:30:32 +00:00
Scheduler: shutdown async pool properly instead of relying on ThreadManager
This commit is contained in:
parent
05f4262e81
commit
c9bd60123b
@ -2046,9 +2046,8 @@ class Server{
|
|||||||
HandlerList::unregisterAll();
|
HandlerList::unregisterAll();
|
||||||
|
|
||||||
if($this->scheduler instanceof ServerScheduler){
|
if($this->scheduler instanceof ServerScheduler){
|
||||||
$this->getLogger()->debug("Stopping all tasks");
|
$this->getLogger()->debug("Shutting down task scheduler");
|
||||||
$this->scheduler->cancelAllTasks();
|
$this->scheduler->shutdown();
|
||||||
$this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->properties !== null and $this->properties->hasChanged()){
|
if($this->properties !== null and $this->properties->hasChanged()){
|
||||||
|
@ -183,4 +183,13 @@ class AsyncPool{
|
|||||||
|
|
||||||
Timings::$schedulerAsyncTimer->stopTiming();
|
Timings::$schedulerAsyncTimer->stopTiming();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function shutdown() : void{
|
||||||
|
$this->collectTasks();
|
||||||
|
$this->removeTasks();
|
||||||
|
foreach($this->workers as $worker){
|
||||||
|
$worker->quit();
|
||||||
|
}
|
||||||
|
$this->workers = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,6 +310,11 @@ class ServerScheduler{
|
|||||||
return $handler;
|
return $handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function shutdown() : void{
|
||||||
|
$this->cancelAllTasks();
|
||||||
|
$this->asyncPool->shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $currentTick
|
* @param int $currentTick
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user