Author: Wylie Garvin
Date: 12:46:59 12/12/01
Go up one level in this thread
On December 12, 2001 at 10:54:47, Severi Salminen wrote: >Hi! > >How do you poll stdin during search? I just want to see if "quit" is sent to >engine during search. Otherwise my engine keeps searching even if WB has >exited... > >And I don't know anything about multithreading. And I don't even wat to know ;) > >Severi I recommend you take a look at this page on Tim Mann's xboard/winboard site: http://www.tim-mann.org/xboard/engine-intf.html#6 It describes what I consider to be a flexible method for handling input while the program is (possibly) thinking. It can be implemented either with a periodic polling for input or with multithreaded input. I successfully applied the methods described on that page a few months ago in a Win32 C++ program. The only really bizarre thing I had to deal with was that as long as I had an outstanding ReadFile() call blocked in my input thread, all my efforts to kill the thread were futile! There are several of this sort of bogosity on Win32 platforms. This one was incredibly annoying because my input was actually being *parsed* in the main thread, not the input thread (which I think is what makes sense; the engine thinks for a while, then it comes along and says, "oho, some input" and then it parses it and does whatever it's supposed to do). I eventually added a BRUTAL hack to the input thread so that on detecting a case variant of the string "quit\n" it would cleanly terminate itself. Yuck. good luck, wylie
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.