[fpc-devel] Threads and alot of crap continued

Michael Schnell mschnell at lumino.de
Tue Nov 7 16:02:25 CET 2006


> I always thought a timer is more comparable to an interrupt or 
> signal than a polling loop.
>   

That is a very common misconception. A TTimer event is not an interrupt 
in that it does not interrupt any code in the Application. such an 
"automatic event" is always done in the main thread and only started 
when (1) the application is idle, (2) the application comes back from 
some other event, or (3) Application.ProcessMessages is called. Only 
another thread can be interrupted ("preempted") by such an event.

The big advantage is that you do not need to protect any resources from 
multi-threaded access if you do not explicitly create a thread by means 
of TThread.

-Michael



More information about the fpc-devel mailing list