mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
AsyncPool: Do not drop pending tasks on shutdown
this creates an extra element of uncertainty for async pool usage.
This commit is contained in:
parent
f245147c11
commit
22b5e5db5e
@ -313,20 +313,8 @@ class AsyncPool{
|
||||
* Cancels all pending tasks and shuts down all the workers in the pool.
|
||||
*/
|
||||
public function shutdown() : void{
|
||||
$this->collectTasks();
|
||||
|
||||
foreach($this->workers as $worker){
|
||||
/** @var AsyncTask $task */
|
||||
while(($task = $worker->unstack()) !== null){
|
||||
//NOOP: the below loop will deal with marking tasks as garbage
|
||||
}
|
||||
}
|
||||
foreach($this->taskQueues as $queue){
|
||||
while(!$queue->isEmpty()){
|
||||
/** @var AsyncTask $task */
|
||||
$task = $queue->dequeue();
|
||||
$task->cancelRun();
|
||||
}
|
||||
while($this->collectTasks()){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
foreach($this->workers as $worker){
|
||||
|
Loading…
x
Reference in New Issue
Block a user