[Lazarus] How to PostMessage to object?
Krzysztof
dibo20 at wp.pl
Wed Jun 8 17:28:43 CEST 2011
Hm, I forgot about Application.QueueAsyncCall. And this can be safely call
from thread without TThread.Synchronize() ? Because I don't want use
Synchronize() in any part of thread code. So this is correct code? :
procedure TMyThread.Execute;
begin
// <some code here>
Application.QueueAsyncCall(@SomeObj.TestMethod, PtrInt(NewStr('Some
value')));
// <some code here>
end;
There is no chance for deadlock with main thread calling this from inside
another thread?
But can be problem here if thread try call "Application.QueueAsyncCall" for
object which was freed (AV occur). PostMessage just return false if handle
doesn't exists.
2011/6/8 Michael Schnell <mschnell at lumino.de>
> On 06/08/2011 04:57 PM, Krzysztof wrote:
>
>> How can I PostMessage from thread to another object?
>>
> While "PostMessage()" and "Procedure...Message" is available with Lazarus,
> you better use the non-Windowish Application.QueueAsyncCall() procedure.
>
> BTW.: with Delphi, you mostly better user TThread.Queue for this purpose.
>
> -Michael
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110608/da0c2a64/attachment-0003.html>
More information about the Lazarus
mailing list