Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A Delphi - WinBoard problem

Author: Tony Werten

Date: 23:11:11 09/26/04

Go up one level in this thread


On September 26, 2004 at 14:47:23, Martin Giepmans wrote:

>On September 26, 2004 at 11:31:21, Tony Werten wrote:
>
>>On September 25, 2004 at 14:48:34, Martin Giepmans wrote:
>>
>>>Thanks for all the hints! The problem is solved now, thanks to a remark of
>>>Tony Werten that made me see the light. ;)
>>>
>>>In the mean time Guenther Simon discovered another problem.
>>>When it is connected to winboard the engine doesn't function properly in Windows
>>>XP, but so far it seems to work well in other gui's.
>>>Grrrrrrr .. ;)
>>
>>_lwrite foesn't seem to work under XP
>>
>>try something like
>>
>>   EnterCriticalSection(synchyobj);
>>   if not(stop_request) then
>>   begin
>>      len:=length(tekst);
>>      msg:=copy(tekst,1,len);
>>      for t:=1 to len do
>>      begin
>>         write(output,msg[t]);
>>         flush(output);
>>      end;
>>      write(output,#10);
>>      flush(output);
>>   end;
>>   LeaveCriticalSection(synchyobj);
>>
>>I can't really remember anymore why the copy is in there :)
>>
>>Tony
>
>
>I don't use _lwrite but simply write, like you do in the above code.
>Also no LeaveCriticalSection stuff, is it necessary? (Perhaps you are using a
>seperate thread for output? I only use one for input)

yes, it made sure only 1 thread is writing stuff out.

>
>The only problem in XP (when using winboard) is now that something goes wrong
>when my engine plays another engine on the same one processor machine and both
>engines ponder. (I guess it's okay for a dual machine, didn't test that yet)
>With pondering off everything is fine.
>
>I have send a new version to Guenther with a few extra
>application.processmessages (without sleep) in it. Perhaps that solves the
>problem.
>What I don't understand (if it solves the problem) is why XP would need this
>(and apparently only with winboard, everything works fine in the Fritz gui).
>Windows 98 and ME don't need it.

I have to dig deep in my memory, but iirc, sleep() isn't threadsafe. You should
use sleep_ex ( or something, or not at all). Probably, winboard does exactly
that what makes sleep() unsafe.

Tony

ps It's the Delphi sleep() that is unsafe, the winapi Sleep() is ok, but you can
acces that one.

>
>Could it be that XP buffers I/O differently?
>
>Martin



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.