[fpc-pascal] Sleep(30) is not reliable?
AlexeyT
aaa5500 at ya.ru
Wed Jan 24 17:01:42 CET 2018
In Lazarus component EControl I call Sleep(30) to wait when timer tick
work is done.
while FBusy do Sleep(30);
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, at 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
More information about the fpc-pascal
mailing list