<p>Am 13.09.2013 10:47 schrieb "Michael Schnell" <<a href="mailto:mschnell@lumino.de">mschnell@lumino.de</a>>:<br>
><br>
> On 09/13/2013 06:06 AM, <a href="mailto:wkitty42@windstream.net">wkitty42@windstream.net</a> wrote:<br>
>><br>
>> would this hamper or cause problems with normal non-gui programs using the library?<br>
><br>
><br>
> 1) This feature of course should only be provided additionally to the functions we know and love.<br>
><br>
> 2) Other than the work-alike "Application.QueueAsyncCall" which is provided by Lazarus long since, the rather new "TThread.Queue" is not only Delphi-compatible, but it also is located in the RTL and thus can be used in LCL based nongui applications and even without linking to the LCL at all.<br>
><br>
> You need to do calls to a "synchronize" function which the RTL provides, to pull the event queue. This _can_ be done in a close loop (e.g. containing a sleep() call), which of course increases latency and processor overhead. Better it is done by a decent triggering mechanism (e.g. using a semaphore or self-piping) the loop waits for and each queue push triggers.<br>
><br>
> This is another improvement I hope for: enhancing the synchronize and TThread.Queue/TThread.Synchronize features in the RTL in an OS-depending way that (optionally) automatically pulls the queue for the main thread.</p>
<p>As we have already written in some previous mails to there is a global event procedure to wake up the main thread that is triggered when something is queued. The LCL uses this already and other programs could use a TEvent or whatever.</p>
<p>Regards,<br>
Sven</p>