[Lazarus] How to PostMessage to object?
henry.vermaak at gmail.com
Thu Jun 9 10:58:35 CEST 2011
On 09/06/11 09:50, Michael Schnell wrote:
> 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 will corrupt the linked list that QueueAsyncCall uses when you call
it from multiple threads, so you _must_ protect it.
> 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.
It doesn't matter if it's the same event or not, all events are stored
in a list by QueueAsyncCall. I don't know why they didn't use a
thread-safe queue for this.
More information about the Lazarus