Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: .bat file playing tricks on me, help !!

Author: Carmelo Calzerano

Date: 09:43:47 11/19/03

Go up one level in this thread


On November 19, 2003 at 02:45:50, Georg v. Zimmermann wrote:

>The same happens ...
>
>btw. Dieter suggested in the winboard forum there might be a problem with my
>input thread implementation, which makes sense. Unfortunately it isnt really
>*my* implementation so I guess I am stuck hehe.
>

Hello Georg,

It seems you don't check for the EOF condition in your input thread.
I just downloaded Sunsetter and gave a quick look at the RunInput() fuction.

The problem here is that, when the input file ends, the read() function
returns 0 immediately: since your input thread does not check for this
condition, it continues to poll the input indefinitely, eating your CPU
resources.

Adding the following line to the RunInput() function should be enough to
solve your problem - at least, I hope so :-)

    .....

    numRead = read(0, &c, 1);        // BLOCKING read of stdin
    if (numRead<=0) break;           // Line added

    .....

HTH,
Carmelo Calzerano




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.