Author: Odd Gunnar Malin
Date: 14:04:14 09/24/04
Go up one level in this thread
On September 24, 2004 at 14:45:38, Martin Giepmans wrote: > >In my Delphi engine I have a thread that polls input when the engine is >connected to WinBoard. >Now it turns out that it steals time when it plays another engine under WinBoard >with pondering off. >According to TaskInfo it still claims about half of the processor time when the >other engine is thinking. >I have tried sleep() but it doesn't work, perhaps because I don't use sleep() in >the right way. > >Does anybody know how to solve this problem in Delphi? > > >My polling routine looks like this (I left out what is not relevant): > >procedure Tconindraad.Execute; > >var c:char; buffer:string; > >begin buffer:=''; >repeat >if conintekst='' then > begin read(input,c); > if c=#10 then > begin if buffer<>'' then conintekst:=buffer; > buffer:='' > end > else buffer:=buffer+c > end >until terminated >end; > > >(The content of buffer is passed to conintekst. The engine reads conintekst >and sets it to '', so that the polling routine knows that the engine is >ready for the next input) > > >Martin I don't know anything about delphi, but can't you use a function that don't return until there is something in the input que, and let the os to the waiting. If you can call Win api direct, ReadFile works like this. Odd Gunnar
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.