On 04/05/2012 02:37 PM, michael.vancann...@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



--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to