On Wed, 24 Jan 2018, AlexeyT wrote:

In Lazarus component EControl I call Sleep(30) to wait when timer tick work is done.

while FBusy do Sleep(30);

How is the FBusy set to false ?

You should add an Application.Processmesages in this loop, otherwise the
timer tick (or whatever event sets FBusy to false) will never happen ?.

while FBusy do
  begin
  Sleep(30);
  Application.ProcessMessages;
  end;

Michael.

and app loops forever now in sleep().

procedure Sleep(milliseconds: Cardinal);
Var
  timeout,timeoutresult : TTimespec;
  res: cint;
begin
  timeout.tv_sec:=milliseconds div 1000;
  timeout.tv_nsec:=1000*1000*(milliseconds mod 1000);
  repeat
    res:=fpnanosleep(@timeout,@timeoutresult);
    timeout:=timeoutresult;
  until (res<>-1) or (fpgeterrno<>ESysEINTR);
end;

It is fpc 3.0.2. IDE Lazarus shows long loop inside this 'repeat'. i waited 10-20seconds.


--
Regards,
Alexey

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to