[fpc-devel] Threads and alot of crap continued

Vinzent Hoefler JeLlyFish.software at gmx.net
Tue Nov 7 16:14:29 CET 2006


On Tuesday 07 November 2006 14:47, Michael Schnell wrote:

> > Well, for me it would have saved me some time which I wasted in
> > creating threads that implement "timing events" by simply sleeping
> > for a particular time.
>
> IMHO this should be done following the Delphi paradigms to be nice to
> Delphi users coming over to FCP (only enhancement allowed). Of course
> Lazarus does this, but IMHO it would be great to have this in a
> system without a GUI, too.

At first: It doesn't matter how it's done to me as long as it works. :)

My system is a system without a GUI, or to be more precise: with a 
remote (G)UI. That's why I don't know about LCL or whatever and I don't 
even care, because I simply don't understand what "time" as in "timer" 
has to do with "graphics" as in "graphical". For me that's two 
completely different subjects unless we're talking about animations 
where those two subjects meet.

All I needed was a simple timer, so that some user supplied routine was 
being called after some specified time has been elapsed. There's 
nothing complicated in that view of the programming model, because it's 
the user's view. I implemented that by using an additional thread in a 
relatively simple way, although its execute method was merely a

|while not self.Terminated do
|begin
|   SysUtils.Sleep (self.Interval);
|   self.Logger.Flush;
|end {while};

to take care of my requirement that the Flush-routine of the logger 
object would be called once in a while.

If "following the Delphi paradigm" leads to such complicated solutions 
as layed out here by Ales (and I'm still talking about the user's view 
here, not any particular implementation) I surely can live without such 
a solution.


Vinzent.




More information about the fpc-devel mailing list