mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
ThreadManager: Lazy-init during getInstance()
This commit is contained in:
parent
faef4e8736
commit
fe5620f097
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user