[fpc-devel] Threads and alot of crap continued

Vinzent Hoefler JeLlyFish.software at gmx.net
Wed Nov 8 14:47:56 CET 2006


On Wednesday 08 November 2006 13:21, Micha Nelissen wrote:
> Vinzent Hoefler wrote:
> >    repeat
> >       SysUtils.Sleep (self.Interval);
> >       self.Logger.Flush;
> >    until self.Terminated;
> >
> > is totally impossible to work? To implement something less crude
> > you
>
> It works,

Oh wonder. A couple of lines ago these semantics were still 
"impossible".

> but it's not realtime by any definition.

First, I never said "real-time" in that context and second: it sure can 
be, if the thread's priority demands an immediate wake-up after the 
sleep.

Then and if implemented a litte bit less crude - as I suggested - it 
would be no less real-time than

|declare
|   Next_Cycle : Ada.Real_Time.Time := Ada.Real_Time.Clock;
|   CYCLE_TIME : constant Ada.Real_Time.Time_Span :=
|                  Ada.Real_Time.To_Time_Span (1.0);
|   use type Ada.Real_Time.Time;
|begin
|   loop
|      Next_Cycle := Next_Cycle + CYCLE_TIME;
|      Do_Some_Work;
|      delay until Next_Cycle;
|   end loop;
|end;

in Ada would be. And the jitter in the above Ada code was about 30 
microseconds running on an RTOS, of course.


Vinzent.




More information about the fpc-devel mailing list