From 768046d29eff91d4afbcea23dcb2a623a6a747c9 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 7 Jan 2015 17:50:20 +0100 Subject: [PATCH] Fix blocking of input in ponder games The blocking of input during thinking did break pondering, as a ponder miss also used pause = 2 to schedule ignoring of the 'bestmove' reply to 'stop'. This now uses pause = 1 again, while after a ponder hit the input thread is blocked after turning pause into 2, indicating the 'bestmove' is for real. --- UCI2WB.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index 856ada3..9f1ad06 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -157,7 +157,7 @@ void StopPonder(int pondering) { if(!pondering) return; - pause = 2; + pause = 1; fprintf(toE, "stop\n"); fflush(toE); DPRINT("# stop\n"); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' Sync(PAUSE); // wait for engine to acknowledge 'stop' with 'bestmove'. } @@ -417,6 +417,7 @@ GUI2Engine() char *draw = drawOffer ? " draw" : ""; drawOffer = 0; pondering = 0; moveNr++; startTime = GetTickCount(); // clock starts running now fprintf(toE, "ponderhit%s\n", draw); DPRINT("# ponderhit%s\n", draw); + fflush(toE); fflush(stdout); pause = 2; Sync(PAUSE); // block input during thinking goto nomove; } StopPonder(1); -- 1.7.0.4