Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: questions about using fget as waiting loop

Author: Uri Blass

Date: 05:15:13 08/31/04

Go up one level in this thread


On August 30, 2004 at 19:51:17, Robert Hyatt wrote:

>On August 30, 2004 at 18:39:58, Dieter Buerssner wrote:
>
>>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
>
>Yes.  _if_ you disable buffering.  But it seems that Uri has not, and has been
>simply lucky...

I am not sure exactly what I do.
I know that I copied some non chess related code in the past from dieter and it
is possible that I also disable buffering.

Uri



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.