[fpc-pascal] lnet for TCP daemon

Sven Barth pascaldragon at googlemail.com
Fri Sep 13 19:08:02 CEST 2013


Am 13.09.2013 10:47 schrieb "Michael Schnell" <mschnell at lumino.de>:
>
> On 09/13/2013 06:06 AM, wkitty42 at windstream.net wrote:
>>
>> would this hamper or cause problems with normal non-gui programs using
the library?
>
>
> 1) This feature of course should only be provided additionally to the
functions we know and love.
>
> 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.
>
> 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.
>
> 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.

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.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130913/df62c78b/attachment.html>


More information about the fpc-pascal mailing list