[Lazarus] How to PostMessage to object?

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jun 9 11:15:18 CEST 2011


 
 

 Michael Schnell <mschnell at lumino.de> hat am 9. Juni 2011 um 10:50 geschrieben:

 > 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 
How many calls per second do you want to execute via the main thread?

 QueueAsyncCall is *not* thread safe.  If QueueAsyncCall should be made thread
safe, then TApplication must be extended to use a critical section for it (or
some lock-free queue, but since we are talking about the GUI thread, latency is
already so bad, that this makes no difference).
 
Afaik all PostMessages implementations use a critical section. So you don't need
to do that yourself.
 
 
 >[...]

 Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110609/eac40b0c/attachment-0003.html>


More information about the Lazarus mailing list