[fpc-devel] Threads and alot of crap continued

Michael Schnell mschnell at lumino.de
Wed Nov 8 11:14:15 CET 2006

> It all depends on what you're trying to accomplish. I still like to have 
> a "asynchronous timer event" model. It would still simplify some code.
You are right that this would be desirable.

Normal Delphi/Lazarus like TTimers are non-preemptive (you may call it 
synchronous) for a good reason (as already discussed at some length).

Preemptive timers ("asynchronous" timers, using threads) can be very 
useful too, and Delphi/Lazarus don't offer any portable means to do 
them. So there is a good reason for enhancement.

If you take a look the start of this thread, I mentioned that after 
implementing Delphi/Lazarus like behavior for the main thread without 
the need for a GUI, I'd like to enhance the concept by optionally having 
an TApplication object for any thread (e.g. TThread.Application) and 
thus having an event scheduler for same. By this it would be possible to 
implement TTimer in a way that it's callbacks can be fired in the 
context of a thread and thus "asynchronous timer event" are possible in 
a completely compatible way, allowing the user to define, regarding what 
context the event is asynchronous. IMHO this would be a great plus for 
any embedded "real-time" use of FPC.


More information about the fpc-devel mailing list