mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
AsyncPool: Unstack tasks from workers before entering the below loop
This commit is contained in:
parent
b7ca045c51
commit
7fce48d38c
@ -123,6 +123,15 @@ class AsyncPool{
|
||||
}
|
||||
|
||||
public function removeTasks(){
|
||||
foreach($this->workers as $worker){
|
||||
/** @var AsyncTask $task */
|
||||
while(($task = $worker->unstack()) !== null){
|
||||
//cancelRun() is not strictly necessary here, but it might be used to inform plugins of the task state
|
||||
//(i.e. it never executed).
|
||||
$task->cancelRun();
|
||||
$this->removeTask($task, true);
|
||||
}
|
||||
}
|
||||
do{
|
||||
foreach($this->tasks as $task){
|
||||
$task->cancelRun();
|
||||
|
Loading…
x
Reference in New Issue
Block a user