mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Added thread stop message
This commit is contained in:
parent
9f34d22013
commit
8446bd2ba5
@ -347,21 +347,33 @@ namespace pocketmine {
|
|||||||
ThreadManager::init();
|
ThreadManager::init();
|
||||||
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||||
|
|
||||||
|
$logger->info("Stopping other threads");
|
||||||
|
|
||||||
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
|
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
|
||||||
if($thread->isRunning()){
|
if($thread->isRunning()){
|
||||||
$logger->debug("Stopping ".(new \ReflectionClass($thread))->getShortName()." thread");
|
$logger->debug("Stopping ".(new \ReflectionClass($thread))->getShortName()." thread");
|
||||||
if($thread instanceof Thread){
|
if($thread instanceof Thread){
|
||||||
$thread->kill();
|
$thread->kill();
|
||||||
$thread->detach();
|
|
||||||
|
if($thread->isRunning() or !$thread->join()){
|
||||||
|
$thread->detach();
|
||||||
|
}
|
||||||
}elseif($thread instanceof Worker){
|
}elseif($thread instanceof Worker){
|
||||||
$thread->shutdown();
|
|
||||||
$thread->kill();
|
$thread->kill();
|
||||||
$thread->detach();
|
sleep(1);
|
||||||
|
if($thread->isRunning() or !$thread->join()){
|
||||||
|
$thread->detach();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}elseif(!$thread->isJoined()){
|
||||||
|
$logger->debug("Joining ".(new \ReflectionClass($thread))->getShortName()." thread");
|
||||||
|
$thread->join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$logger->shutdown();
|
$logger->shutdown();
|
||||||
$logger->join();
|
$logger->join();
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user