mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +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){
|
||||
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", $line);
|
||||
}, $this->buffer, $line);
|
||||
$lastLine = microtime(true);
|
||||
}elseif((microtime(true) - $lastLine) <= 0.1){ //Non blocking! Sleep to save CPU
|
||||
usleep(40000);
|
||||
}
|
||||
|
||||
$lastLine = microtime(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user