mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Added MemoryManager object watcher for object leak debugging, improved SPL Thread/Worker stopping, fixed some possible weak references crashing unexpectedly
This commit is contained in:
@ -63,4 +63,26 @@ abstract class Worker extends \Worker{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
|
||||
*/
|
||||
public function quit(){
|
||||
if($this->isRunning()){
|
||||
$this->unstack();
|
||||
$this->kill();
|
||||
$this->detach();
|
||||
}elseif(!$this->isJoined()){
|
||||
if(!$this->isTerminated()){
|
||||
$this->join();
|
||||
}else{
|
||||
$this->kill();
|
||||
$this->detach();
|
||||
}
|
||||
}else{
|
||||
$this->detach();
|
||||
}
|
||||
|
||||
ThreadManager::getInstance()->remove($this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user