Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: how to find out if stuff is in winboard pipe in c?

Author: Robert Hyatt

Date: 06:28:51 09/27/00

Go up one level in this thread


On September 27, 2000 at 06:27:13, Mike Adams wrote:

>    In the past my engine has not read from the pipe untill after it was done
>thinking. this meant the rematch command did not work half the time if it was
>still thinking when the new game started.  So i thought why doesnt pulsar look
>at the pipe every 5000 nodes to see if the result command has been issued. Also
>this ability is neccesary for pondering.
>    i use the read statement to read the pipe. a=read(0,  buffer, 500);
>this works fine accept when i called it during search there was nothing in the
>pipe and it just hung tell i resigned, i was playing it as a guest, then it got
>the result info and it told it the game was over. i put output before and after
>the read statement so i realized it never left the line of code involving read
>tell there was something to read.
>    How do i poll the pipe to see if something is there before calling read in
>c?  I see in engine info.txt that the select command is recomended but in
>reading msdn i can find nothing involving select that is for c.  Sample code
>would be appreciated.  Pulsar uses windows 98.


For an example, look at crafty's source, utility.c, "CheckInput()" is the
function.  It uses the peekNamedPipe() function for windows, and "select" for
unix.  But notice that you can not use buffered I/O routines.  The interface-eng
document gives the hints on how to do I/O properly here.



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.