Fix CPU issue when starting without STDIN

This commit is contained in:
Shoghi Cervantes 2014-12-07 02:42:38 +01:00
parent 6104c5b5a3
commit 161e7ae7ec

View File

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