Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Pro Deo in Arena

Author: Odd Gunnar Malin

Date: 13:57:27 09/02/04

Go up one level in this thread


On September 02, 2004 at 16:42:12, Andres Valverde wrote:

>On September 02, 2004 at 16:05:28, Odd Gunnar Malin wrote:
>
>
>>A quick look into the adapter sourse didn't display an easy fix there. Any
>>signal from the gui pipe (broken pipe or handle eof) should result in a 'quit'
>>to the engine.
>>The reason other engine terminate is because Arena kill their process, but with
>>the adapter inbetween it only kill the adapter and it don't get a chance to send
>>a 'quit' to the engine.
>>
>
>What about sending a "quit" to the adapter?
>
>
>>Odd Gunnar

Then it would try to take the engine down kindly with first stop the thinking
process and then send a 'quit'.

The actual routine looks like this:

void stopServer()
{
  int i;
  sendDot=0;

  // Run the stop process with normal priority
  allowPriorityChange=false;
  server.setProcessPriority(NORMAL_PRIORITY_CLASS);
  server.setThreadPriority(THREAD_PRIORITY_NORMAL);
  if (engine==thinking)
  {
    writeServer("?");
    i=0;
    while (engine==thinking)
    {
      Sleep(250);
      i++;
      if (i<20) break;
    }
  }else if (engine==analyze)
  {
    writeServer("exit");
  }
  if (server.pi.hProcess)
  {
    writeServer("quit");
    server.stop(terminateHard);
  }else
  {
    if (engineStarted!=NULL)
      SetEvent(engineStarted);
    else
      handles[0]=NULL;
  }
  allowPriorityChange=true;
}

The 'server.stop(terminateHard)' have a waitloop (5 sec.) before it kill the
engine on terminatehard=true or leave it running if this is false.

Odd Gunnar



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.