[Lazarus] Sending messages

Michael Schnell mschnell at lumino.de
Fri Nov 25 11:12:10 CET 2011


On 11/25/2011 10:35 AM, Hans-Peter Diettrich wrote:
> So what happens on PostMessage, in detail when multiple threads post 
> messages at the same time?
With PostMessage, the events are queued one after the other and (some 
days later) handled in the main thread in this sequence,
>
> TWidgetSet.SendMessage and PostMessage are both documented as 
> thread-safe. Is this correct, and if so, how is that ensured?
> Does a SendMessage call bypass any other messages which have been 
> queued until that time? (by dispatching the message immediately to the 
> target?)
>
AFAIK, SendMessage (like Dispatch) (at least when addressing a GUI 
object) can only be used in the Main thread, as it (might) result din 
just calling the appropriate (not thread safe) LCL function.

-Michael




More information about the Lazarus mailing list