[Lazarus] How to PostMessage to object?

Michael Schnell mschnell at lumino.de
Thu Jun 9 10:50:03 CEST 2011


On 06/08/2011 05:39 PM, Henry Vermaak wrote:
>> There is no chance for deadlock with main thread calling this from
>> inside another thread?
>
>
> You have to protect it with a critical section (if you have more than 
> one thread calling QueueAsyncCall).

A critical section likely will kill the thread latency, so this should 
be avoided

You can fire the same main thread event from many threads. the LCL will 
queue them and the main thread will handle them one after the other.

If designed properly, a deadlock can't happen. You need to take care 
that the data is allocated before sending it to the main thread and the 
main thread deallocates it (see example code).

-Michael




More information about the Lazarus mailing list