[fpc-pascal] lnet for TCP daemon

Michael Schnell mschnell at lumino.de
Fri Sep 13 10:47:01 CEST 2013


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.

-Michael



More information about the fpc-pascal mailing list