mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Clean up Thread/Worker quit()
This commit is contained in:
@ -83,12 +83,9 @@ abstract class Thread extends \Thread{
|
|||||||
public function quit(){
|
public function quit(){
|
||||||
$this->isKilled = true;
|
$this->isKilled = true;
|
||||||
|
|
||||||
$this->notify();
|
|
||||||
|
|
||||||
if(!$this->isJoined()){
|
if(!$this->isJoined()){
|
||||||
if(!$this->isTerminated()){
|
$this->notify();
|
||||||
$this->join();
|
$this->join();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadManager::getInstance()->remove($this);
|
ThreadManager::getInstance()->remove($this);
|
||||||
|
@ -83,16 +83,10 @@ abstract class Worker extends \Worker{
|
|||||||
public function quit(){
|
public function quit(){
|
||||||
$this->isKilled = true;
|
$this->isKilled = true;
|
||||||
|
|
||||||
$this->notify();
|
|
||||||
|
|
||||||
if($this->isRunning()){
|
if($this->isRunning()){
|
||||||
$this->shutdown();
|
while($this->unstack() !== null);
|
||||||
$this->notify();
|
$this->notify();
|
||||||
$this->unstack();
|
$this->shutdown();
|
||||||
}elseif(!$this->isJoined()){
|
|
||||||
if(!$this->isTerminated()){
|
|
||||||
$this->join();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadManager::getInstance()->remove($this);
|
ThreadManager::getInstance()->remove($this);
|
||||||
|
Reference in New Issue
Block a user