diff --git a/src/pocketmine/Thread.php b/src/pocketmine/Thread.php index 2c539b90e..617aa8f53 100644 --- a/src/pocketmine/Thread.php +++ b/src/pocketmine/Thread.php @@ -83,12 +83,9 @@ abstract class Thread extends \Thread{ public function quit(){ $this->isKilled = true; - $this->notify(); - if(!$this->isJoined()){ - if(!$this->isTerminated()){ - $this->join(); - } + $this->notify(); + $this->join(); } ThreadManager::getInstance()->remove($this); diff --git a/src/pocketmine/Worker.php b/src/pocketmine/Worker.php index f79f502d8..a6255b81b 100644 --- a/src/pocketmine/Worker.php +++ b/src/pocketmine/Worker.php @@ -83,16 +83,10 @@ abstract class Worker extends \Worker{ public function quit(){ $this->isKilled = true; - $this->notify(); - if($this->isRunning()){ - $this->shutdown(); + while($this->unstack() !== null); $this->notify(); - $this->unstack(); - }elseif(!$this->isJoined()){ - if(!$this->isTerminated()){ - $this->join(); - } + $this->shutdown(); } ThreadManager::getInstance()->remove($this);