[Lazarus] How to PostMessage to object?
mschnell at lumino.de
Fri Jun 10 09:52:29 CEST 2011
On 06/09/2011 08:00 PM, Krzysztof wrote:
> So, I wrote TMyHTTPClient which is some kind of layer for synapse http
AsyncPro is a good example for something like this:
An instance of an APRO Object (that handles either an asynchronous or a
TCP/IP-Socket based bidirectional stream) internally creates threads
that are assigned to the blocking in and out API functions of the OS.
Mechanisms like that we have been discussing here, are used to make the
interface of the object completely un-threaded (and with that
thread-safe). There are event properties, and the functions defined
there are called in the context of the main thread when an internal
worker thread schedules the event. Data is provided to theses event
handlers in a thread-safe manner.
Multiple requests in this forum and elsewhere suggest that Lazarus would
benefit a lot from an Async-Pro port or work-alike, being part of the
Maybe you can do your project in a way that in a versatile way
implements the core of this: a class that creates internal "in" and
"out" threads and provides hooks for attaching a blocking interface of
any kind of byte-stream to same.
The now bug-free Application.QueueAsyncCall() should be the perfect
Only downside: AFAIK, right now it is not possible to create a Lazarus
Application that has no GUI binding and provides a working
Application.QueueAsyncCall() and TTimers that would allow you to easily
react on timeouts in the communication you are monitoring. So you
supposedly need to do a GTK2, QT, or Windows application.
More information about the Lazarus