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:
Shoghi Cervantes
2015-05-09 16:10:03 +02:00
parent 7e539ec85a
commit 1a1b8830a4
10 changed files with 158 additions and 30 deletions

View File

@ -465,21 +465,8 @@ namespace pocketmine {
$logger->info("Stopping other threads");
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
if($thread->isRunning()){
$logger->debug("Killing " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->kill();
sleep(1);
$thread->detach();
}elseif(!$thread->isJoined()){
if(!$thread->isTerminated()){
$logger->debug("Joining " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->join();
}else{
$logger->debug("Killing " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->kill();
$thread->detach();
}
}
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->quit();
}
$logger->shutdown();