From: H.G.Muller Date: Tue, 28 Oct 2014 07:44:34 +0000 (+0100) Subject: Remove possible deadlock X-Git-Tag: v2.0~13 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=40e7829923848cce4b40d855238f881840dc3e26;p=uci2wb.git Remove possible deadlock Add some flush() calls to make sure we are not waiting for a response to something we still have buffered. --- diff --git a/UCI2WB.c b/UCI2WB.c index eeb93c3..1944b4b 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -246,7 +246,6 @@ Engine2GUI() sscanf(line, "bestmove %s", move[moveNr++]); myTime -= (GetTickCount() - startTime)*1.02 + inc; // update own clock, so we can give correct wtime, btime with ponder if(mps && ((moveNr+1)/2) % mps == 0) myTime += tc; if(sTime) myTime = sTime; // new session or move starts - stm = WHITE+BLACK - stm; // first start a new ponder search, if pondering is on and we have a move to ponder on if(p = strstr(line+9, "ponder")) { @@ -368,7 +367,7 @@ GUI2Engine() if((computer == stm || computer == ANALYZE) && !suspended) { DPRINT("# start search\n"); - LoadPos(moveNr); // load position + LoadPos(moveNr); fflush(stdout); // load position // and set engine thinking (note USI swaps colors!) startTime = GetTickCount(); if(computer == ANALYZE) { @@ -395,7 +394,7 @@ GUI2Engine() if(sc == 'x') { if(newGame) fprintf(toE, "setoption newgame\n"); } else // optional in UCCI fprintf(toE, "u%cinewgame\n", sc); fflush(toE); pause = 1; // wait for option settings to take effect - fprintf(toE, "isready\n"); + fprintf(toE, "isready\n"); fflush(toE); Sync(PAUSE); // wait for readyok } else if(!strcmp(command, "usermove")) {