X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=677e21cfb47bcb97df4eb98217e59cf5d5237f56;hb=a7db862b2f44d23b358a1319cd8a374cf88c24fd;hp=9f9f63e61d8e385377b616235c0fbc48bfccffee;hpb=2f639b510cfc1a6f686919baa024bd7613f9a095;p=xboard.git diff --git a/backend.c b/backend.c index 9f9f63e..677e21c 100644 --- a/backend.c +++ b/backend.c @@ -12084,6 +12084,7 @@ TwoMachinesEvent P((void)) char buf[MSG_SIZ]; ChessProgramState *onmove; char *bookHit = NULL; + static int stalling = 0; if (appData.noChessProgram) return; @@ -12120,13 +12121,23 @@ TwoMachinesEvent P((void)) ResurrectChessProgram(); /* in case first program isn't running */ if(WaitForSecond(TwoMachinesEventIfReady)) return; - DisplayMessage("", ""); - InitChessProgram(&second, FALSE); - SendToProgram("force\n", &second); if(first.lastPing != first.lastPong) { // [HGM] wait till we are sure first engine has set up position + DisplayMessage("", _("Waiting for first chess program")); + ScheduleDelayedEvent(TwoMachinesEvent, 10); + return; + } + if(!stalling) { + InitChessProgram(&second, FALSE); + SendToProgram("force\n", &second); + } + if(second.lastPing != second.lastPong) { // [HGM] second engine might have to reallocate hash + if(!stalling) DisplayMessage("", _("Waiting for second chess program")); + stalling = 1; ScheduleDelayedEvent(TwoMachinesEvent, 10); return; } + stalling = 0; + DisplayMessage("", ""); if (startedFromSetupPosition) { SendBoard(&second, backwardMostMove); if (appData.debugMode) {