#1 2015-10-03 04:02:43

ComingNine
Member
Registered: 2010-07-29
Posts: 294

FixedWaitFor doesn't work under CentOS 5/6/7 when compiled with Kylix.

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

#2 2015-10-03 12:25:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: FixedWaitFor doesn't work under CentOS 5/6/7 when compiled with Kylix.

I do not have any CentOS distro installed.

Could you try to find out what's wrong?

Offline

#3 2015-10-04 07:37:36

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: FixedWaitFor doesn't work under CentOS 5/6/7 when compiled with Kylix.

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

#4 2015-10-04 07:43:58

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: FixedWaitFor doesn't work under CentOS 5/6/7 when compiled with Kylix.

PS:

Probably the two occurrences of "{$ifdef USESEMTRYWAIT}" in SynCommons.FixedWaitFor source code should be "{$ifndef USESEMTRYWAIT}" ?

Offline

Board footer

Powered by FluxBB