31 private bool $stopped =
false;
33 public function __construct(
37 protected function onRun() :
void{
38 $start = hrtime(
true);
39 $remaining = $this->time * 1_000_000;
40 $this->
synchronized(
function() use (&$remaining, $start) :
void{
41 while(!$this->stopped && $remaining > 0){
42 $this->wait($remaining);
43 $remaining -= intdiv(hrtime(
true) - $start, 1000);
47 echo
"\nTook too long to stop, server was killed forcefully!\n";
52 public function quit() :
void{
53 $this->
synchronized(
function() :
void{
54 $this->stopped =
true;
60 public function getThreadName() :
string{
61 return "Server Killer";