mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
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:
parent
48dda9d634
commit
c39c260239
|
@ -925,7 +925,8 @@ public class DroidComputerPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized int getReadTimeout() {
|
private synchronized int getReadTimeout() {
|
||||||
boolean needGuiUpdate = depthModified || currMoveModified || pvModified || statsModified;
|
boolean needGuiUpdate = (searchRequest != null && searchRequest.currPos != null) &&
|
||||||
|
(depthModified || currMoveModified || pvModified || statsModified);
|
||||||
int timeout = 2000000000;
|
int timeout = 2000000000;
|
||||||
if (needGuiUpdate) {
|
if (needGuiUpdate) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user