[Lazarus] Strange dependency of units

Michael Schnell mschnell at lumino.de
Thu Apr 5 15:20:43 CEST 2012


On 04/05/2012 02:37 PM, michael.vancanneyt at wisa.be wrote:
>
>
> TThread.Synchronize works perfectly in any kind of application outside of
> the LCL.
>
> The main thread just has to call CheckSynchronize at regular intervals.
> (which is what the LCL does for you).
>
Of course I do know this.

But "regular intervals" (aka polling) is not a good idea. For a decent 
application (e.g. embedded stuff on a low performance hardware) you need 
to do a decent event scheduling. This means that the main thread needs 
to go to sleep via an OS API call (to completely free the CPU for other 
threads or external tasks), and that the sleeping main thread needs to 
be woken up (by means of en OS API call) at once if an event (may same 
be thrown by a timer, a Thread or a GUI action) (to allow for the lowest 
possible latency).

This is not trivial at all and worth being provided by a commonly used 
library instead necessary to be re-implement with any project. (This is 
just a statement, not a request !)

The LCL does this quite nicely for all GUI enabled widget set, but not 
for noGUI and friends. But: see giulianos contribution the CustomDrawn 
mailing list.

-Michael






More information about the Lazarus mailing list