mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +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(){
|
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{
|
do{
|
||||||
foreach($this->tasks as $task){
|
foreach($this->tasks as $task){
|
||||||
$task->cancelRun();
|
$task->cancelRun();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user