mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 15:35:31 +00:00
Fix CPU issue when starting without STDIN
This commit is contained in:
parent
6104c5b5a3
commit
161e7ae7ec
@ -87,10 +87,11 @@ class CommandReader extends Thread{
|
|||||||
$this->buffer->synchronized(function (\Threaded $buffer, $line){
|
$this->buffer->synchronized(function (\Threaded $buffer, $line){
|
||||||
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", $line);
|
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", $line);
|
||||||
}, $this->buffer, $line);
|
}, $this->buffer, $line);
|
||||||
$lastLine = microtime(true);
|
|
||||||
}elseif((microtime(true) - $lastLine) <= 0.1){ //Non blocking! Sleep to save CPU
|
}elseif((microtime(true) - $lastLine) <= 0.1){ //Non blocking! Sleep to save CPU
|
||||||
usleep(40000);
|
usleep(40000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lastLine = microtime(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user