ThreadManager: Lazy-init during getInstance()

This commit is contained in:
Dylan K. Taylor 2020-02-05 20:36:44 +00:00
parent faef4e8736
commit fe5620f097
2 changed files with 5 additions and 2 deletions

View File

@ -263,7 +263,6 @@ namespace pocketmine {
//TODO: move this to a Server field
define('pocketmine\START_TIME', microtime(true));
ThreadManager::init();
/*
* We now use the Composer autoloader, but this autoloader is still for loading plugins.

View File

@ -28,10 +28,11 @@ use function spl_object_hash;
class ThreadManager extends \Volatile{
/** @var ThreadManager */
/** @var ThreadManager|null */
private static $instance = null;
/**
* @deprecated
* @return void
*/
public static function init(){
@ -42,6 +43,9 @@ class ThreadManager extends \Volatile{
* @return ThreadManager
*/
public static function getInstance(){
if(self::$instance === null){
self::$instance = new ThreadManager();
}
return self::$instance;
}