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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to