Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor
2020-02-07 18:13:55 +00:00
88 changed files with 543 additions and 283 deletions

View File

@ -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)]);
}
}