Computer Chess Club Archives


Search

Terms

Messages

Subject: OK how?

Author: Scott Gasch

Date: 18:06:42 02/22/01

Go up one level in this thread



>I think spinning off a thread is the best answer. I expected the standard C
>functions for this would work OK on Unix, however.  PeekNamedPipe, etc. has
>always seemed to be quirky in my experience. Besides, it doesn't port to Unix
>either, right? In any case, by my experience, kicking off a thread is easiest
>and gives the best performance in Windows.

Those of you who say to kick off a thread for win32... how does one do in such a
way so that CSRSS.EXE doesn't consume massive CPU?

CreateThread then GetStdHandle then WaitForSingleObject on the handle in a loop?
 When the wait call wakes up flag a global identifier for the engine and wait
for the engine to clear the flag?

Is it better to just do my own I/O... when the wait call returns read into a
private buffer, set a flag, flush stdin and have to engine draw command out of
my own private buffer so that the wait flag can go back to waiting immediately
and not spin?

Has anyone done this already?  This might be something Bob would be interested
in too as I see the crafty code causes the CSRSS.EXE problem too...

A related question: why does WaitForSingleObject on a stdin handle return when
no key has been pressed... can I somehow ignore mouse and resize events?!

Thanks for the help, everyone.
Scott



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.