[Lazarus] How to PostMessage to object?

Henry Vermaak henry.vermaak at gmail.com
Thu Jun 9 12:30:03 CEST 2011


On 09/06/11 11:29, Michael Schnell wrote:
> On 06/09/2011 12:12 PM, Henry Vermaak wrote:
>>
>> Do you propose that QueueAsyncCall throws an exception if it's used
>> from outside the main thread?
> The purpose of QueueAsyncCall() is to use it in worker threads to notify
> the main thread of something that happens in the thread (without the

Where do you find this "purpose".  As Mattias said, the spec says 
nothing of the sort.

>> Otherwise adding a critical section to all the async queue methods is
>> in order.
>>
> IMOH protecting a call to QueueAsyncCall() (in user code or <IMHO
> better> in the LCL itself) by a semaphore should not harm anyway in most
> cases, as there would be no waiting on anything else in that critical
> section. If you assign different priorities to the threads there of
> course is the usual problem of priority inversion.

Protecting it in user code won't work, since the application can still 
remove calls while you try and add them.  It needs to be protected 
inside the lcl or fail.

Henry




More information about the Lazarus mailing list