time = $time; } public function run(){ $this->registerClassLoader(); $start = time(); $this->synchronized(function(){ if(!$this->stopped){ $this->wait($this->time * 1000000); } }); if(time() - $start >= $this->time){ echo "\nTook too long to stop, server was killed forcefully!\n"; @Utils::kill(getmypid()); } } public function quit() : void{ $this->synchronized(function() : void{ $this->stopped = true; $this->notify(); }); parent::quit(); } public function getThreadName() : string{ return "Server Killer"; } }