/* * Check if search should be terminated * * Here we also handle the case that we are in Permanent Brain and have to * check for user input. * */ static int TerminateSearch(struct SearchData *sd) { if ((Nodes+QNodes) > ChkNodes) { unsigned int now = GetTime(); ChkNodes = Nodes+QNodes+NodesPerCheck; if (AbortSearch) return TRUE; CurTime = now; if (CurTime > (StartTime+ONE_SECOND)) PrintOK = TRUE; if (InputReady()) { char buffer[64]; struct Command *theCommand; ReadLine(buffer, 64); /* * the '.' command can only be handled here */ if (buffer[0] == '.') { PrintNoLog(0, "stat01: %d %ld %d %d %d\n", (CurTime - StartTime), Nodes + QNodes, sd->depth, sd->nrootmoves - sd->movenum -1, sd->nrootmoves); } theCommand = ParseInput(buffer); if (theCommand) { if (SearchMode == Pondering && theCommand->move != M_NONE) { if (theCommand->move == PBActMove) { PBHit = TRUE; SearchMode = Searching; Print(1, "OK!\n"); WallTimeStart = now; if (CurTime >= HardLimit) return TRUE; if (DoneAtRoot) return TRUE; return FALSE; } else { PBHit = FALSE; PBAltMove = theCommand->move; return TRUE; } } if (SearchMode == Puzzling && theCommand->move != M_NONE) { PBAltMove = theCommand->move; return TRUE; } if (SearchMode == Analyzing && theCommand->move != M_NONE) { ExecuteCommand(theCommand); return TRUE; } if (theCommand->allowed_during_search) { ExecuteCommand(theCommand); if (theCommand->interrupts_search) { SearchMode = Interrupted; return TRUE; } } } } if (SearchMode == Searching) { if (CurTime >= HardLimit) return TRUE; } } return FALSE; }
void AudioIO::Timeout() { if (data.input_proceed_slot != last_ready_buffer) { last_ready_buffer = data.input_proceed_slot; emit InputReady(); } }