Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A seperate process for the chess engine - How do I do this?

Author: Larry Griffiths

Date: 19:05:29 02/19/99

Go up one level in this thread


On February 19, 1999 at 19:35:14, John Coffey wrote:

>I am using Microsoft Visual C++ with MFC to develope my front end.  I figure
>that I need a way to spawn my engine in a seperate process, and then somehow
>communicate between the two.  Can anyone please tell me how to do this?
>
>John Coffey

John,

At the Windows API level, you would have to use something like CreateThread.
I did this kind of programming under OS/2 but I am running Windows 98
and using the Borland C++ Builder for my chess program.  I could use
CreateThread but will probably inherit a class from TThread which is
a component under Builder.  You would have to share a common piece of
storage for the parent and child processes.  That is how I communicate
between threads.  A thread would sleep for a short time when it does not
have anything to do and then check to see if the other thread updated
a shared storage variable that tells it what to do.  Both threads could
work this way.  There are also all kinds of API calls when working with
threads.  You must have a good understanding of multi-threading so that
you do not update variables at the same time etc.  I could write for days
on this subject but I would suggest going to a bookstore (like Barnes & Noble
or Borders) and find a book on Windows multi-threading.
Good Luck!  (I am going to do the same thing sometime myself)

Larry   :=)



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.