mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-14 22:01:59 +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
|
//TODO: move this to a Server field
|
||||||
define('pocketmine\START_TIME', microtime(true));
|
define('pocketmine\START_TIME', microtime(true));
|
||||||
ThreadManager::init();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We now use the Composer autoloader, but this autoloader is still for loading plugins.
|
* 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{
|
class ThreadManager extends \Volatile{
|
||||||
|
|
||||||
/** @var ThreadManager */
|
/** @var ThreadManager|null */
|
||||||
private static $instance = null;
|
private static $instance = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function init(){
|
public static function init(){
|
||||||
@ -42,6 +43,9 @@ class ThreadManager extends \Volatile{
|
|||||||
* @return ThreadManager
|
* @return ThreadManager
|
||||||
*/
|
*/
|
||||||
public static function getInstance(){
|
public static function getInstance(){
|
||||||
|
if(self::$instance === null){
|
||||||
|
self::$instance = new ThreadManager();
|
||||||
|
}
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user