[fpc-pascal] Sleep(30) is not reliable?
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Thu Jan 25 09:27:43 CET 2018
On 24/01/18 16:15, AlexeyT wrote:
> 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.
What happens if you put an Application.ProcessMessages in there?
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list