You are not logged in.
It seems that SynCommons.FixedWaitFor doesn't work under CentOS 5/6/7 when compiled with Kylix:
The following code tries to run a loop for three times, each time outputting a message before calling "FixedWaitFor" for two seconds. However, only the first call to "FixedWaitFor" works, the second and the third calls return immediately.
It should be noted that enable the define USESEMTRYWAIT in SynCommons.pas does not change the situation.
Could you help to solve this problem ? Thank you very much for your efforts !
program TestWaitFor;
{$APPTYPE CONSOLE}
{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER
uses
FastMM4, SynCommons, SyncObjs, SysUtils;
var I: Integer; Event: TSimpleEvent;
begin
Event := TSimpleEvent.Create;
try
for I := 1 to 3 do begin
Writeln(FormatDateTime('yyyy_mm_dd_hh_nn_ss', Now));
SynCommons.FixedWaitFor(Event, 2 * 1000);
end;
finally
Event.Free;
end;
end.
Offline
Thank you very much for your comment !
It seems that the test code should call "Event.ResetEvent;" in order to work under CentOS 5/6/7 when compiled with Kylix. Not sure why the call to "Event.ResetEvent;" is not needed to work under Windows when compiled with Delphi...
SynCommons.FixedWaitFor(Event, 2 * 1000);
Event.ResetEvent;
SynCommons.FixedWaitFor(Event, 2 * 1000);
Offline
PS:
Probably the two occurrences of "{$ifdef USESEMTRYWAIT}" in SynCommons.FixedWaitFor source code should be "{$ifndef USESEMTRYWAIT}" ?
Offline