Use less CPU while waiting for human player to move

After the engine plays a move in a game, a thread could get into a
state where it would poll for engine output every millisecond while
waiting for the human player to make the next move.

Even though this was not a busy wait, it would still use more CPU
resources than necessary, so the logic has been changed to prevent
this situation.
This commit is contained in:
Peter Osterlund 2020-01-18 13:30:08 +01:00
parent 48dda9d634
commit c39c260239

View File

@ -925,7 +925,8 @@ public class DroidComputerPlayer {
}
private synchronized int getReadTimeout() {
boolean needGuiUpdate = depthModified || currMoveModified || pvModified || statsModified;
boolean needGuiUpdate = (searchRequest != null && searchRequest.currPos != null) &&
(depthModified || currMoveModified || pvModified || statsModified);
int timeout = 2000000000;
if (needGuiUpdate) {
long now = System.currentTimeMillis();