Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: questions about using fget as waiting loop

Author: Dieter Buerssner

Date: 15:39:58 08/30/04

Go up one level in this thread


On August 30, 2004 at 15:39:45, Robert Hyatt wrote:

>On August 30, 2004 at 14:40:25, Uri Blass wrote:
>
>>/* When using Standard C input functions, also check if there
>>is anything in the buffer. After a call to such functions,
>>the input waiting in the pipe will be copied to the buffer,
>>and the call to PeekNamedPipe can indicate no input available.
>>Setting stdin to unbuffered was not enough, IIRC */
>>//input_init();
>>	if (stdin->_cnt > 0)
>>		return 1;
>That will not work reliably.  If you run with winboard/xboard long enough it is
>guaranteed to hang for the reason I gave.  PeekNamedPipe will not see input that
>has already been read by the C library and tucked away in a library buffer.

It seems to work very reliably for me. See the above comment in the code (I
actually wrote that comment ...).

Under Unix, setting stdin to non-buffered  by the Standard C function setvbuf
and using select seems to work reliably, too. I read all the input with the
Standard C FILE * interface.

Regards,
Dieter





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.