[Lazarus] Sending messages
mschnell at lumino.de
Mon Nov 28 09:59:13 CET 2011
On 11/26/2011 11:50 AM, Hans-Peter Diettrich wrote:
> E.g. it's well known that a single-threaded applications should call
> Application.ProcessMessages during lengthy tasks, in order to keep the
> GUI responsive. Is something like that required in threads, too, or
> what else is the suggested way for inter-thread communication, instead
> of sending messages?
It's is not _possible_ in worker threads as Application.ProcessMessages
Messages is not thread safe in any way (and there is not work alike for
It's not _viable_ in worker threads as Threads don't provide their own
Event Queues and thus there is no Message that could Processed.
In fact, worker threads do not provide Event driven programming.
I already years ago suggested, that Lazarus should be enhanced to allow
for "Object-Pascal-style" event driven programming in worker threads
(i.e. allowing for creating a TApplication instance for threads - with
or without the possibility to create visible forms for threads), but
this of course is quite a seldom issued request and needs a lot of very
basic work in the LCL, and is not "Delphi-compatible". So I suppose the
the chances that anybody is inclined to take on this work are very small.
More information about the Lazarus