Page 1 of 1

Threaded Input/Search Implementation for Winboard Protocol

PostPosted: 10 Sep 2006, 14:25
by Pradu
I'm trying to design an impelmentation of the winboard protocol where you have seperate threads for input and search. My current attempts at this design seem very complicated:

Image

Does anyone have a simpler way of implementing threaded input?

Re: Threaded Input/Search Implementation for Winboard Protoc

PostPosted: 10 Sep 2006, 16:10
by Richard Pijl
My method is rather simple, and resembles a polling implementation.

The input thread is reading input, parsing the command, and when the command is found to be syntactically correct, pushes it into a command queue.

The main program/search is checking whether there is something on the command queue periodically, or when idle, when the input thread sends an event to the main program.

The main difference with the polling implementation is that search is only interrupted when there is a full command at the input. Not, like with polling input, when the operator just happened to have touched a key, or triggered the polling function by some other means (some mouse events in win2k did that to me as well). Just got sick of it and decided to do it this way.
Richard.

Re: Threaded Input/Search Implementation for Winboard Protoc

PostPosted: 10 Sep 2006, 20:24
by Peter Fendrich
Hi Pradu
Take a look at my template for a separate input thread.
It is simple I think. The same approach or at least similar to Richards.


http://alaric.fendrich.se/Inputthread,code.html

/peter

Re: Threaded Input/Search Implementation for Winboard Protoc

PostPosted: 10 Sep 2006, 20:53
by Pradu
Thanks Peter and Richard! I'll check it out.