mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Merge branch 'stable'
This commit is contained in:
@ -27,7 +27,7 @@ use function spl_object_id;
|
||||
|
||||
class ThreadManager extends \Volatile{
|
||||
|
||||
/** @var ThreadManager */
|
||||
/** @var ThreadManager|null */
|
||||
private static $instance = null;
|
||||
|
||||
public static function init() : void{
|
||||
@ -35,6 +35,9 @@ class ThreadManager extends \Volatile{
|
||||
}
|
||||
|
||||
public static function getInstance() : ThreadManager{
|
||||
if(self::$instance === null){
|
||||
self::$instance = new ThreadManager();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
@ -43,7 +46,7 @@ class ThreadManager extends \Volatile{
|
||||
*/
|
||||
public function add($thread) : void{
|
||||
if($thread instanceof Thread or $thread instanceof Worker){
|
||||
$this->{spl_object_id($thread)} = $thread;
|
||||
$this[spl_object_id($thread)] = $thread;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +55,7 @@ class ThreadManager extends \Volatile{
|
||||
*/
|
||||
public function remove($thread) : void{
|
||||
if($thread instanceof Thread or $thread instanceof Worker){
|
||||
unset($this->{spl_object_id($thread)});
|
||||
unset($this[spl_object_id($thread)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user