[Lazarus] Application.QueueAsyncCall and checking if object still exists

Krzysztof dibo20 at wp.pl
Fri Sep 23 17:49:42 CEST 2011


Hm, TThreadList is good idea. I could try create global ThreadList and add
http responses from thread into that list, then only post some notify
message to main thread which would mean that main thread should peek and
parse objects from ThreadList. I try with that. Thanks

2011/9/23 Michael Schnell <mschnell at lumino.de>

> On 09/22/2011 05:28 PM, Krzysztof wrote:
>
>>
>> Main problem is: I don't know how to tell thread (which is locked in
>> QueueAsyncCall critical section), that method pointer which he trying to
>> post, doesn't exists anymore.
>>
>>  Seemingly you want to create a queue of objects and/or strings that are
> sent from the Thread to the Main thread, and want to be sure that the main
> thread in fact handles all of them.
>
> If just doing a progress indicator, it would not harm if some events in the
> main thread would be dropped, so IMHO it would be a better way to use a
> global integer variable that is written by the thread and read by the main
> thread. So no object or string creation is necessary.
>
> If you really need to dedicatedly handle all events I;HO a good way is to
> use a TThreadList with "add" in the thread.
>
> Another  thing to watch is how the reference counting strings are handled.
> Are they correctly kept life when the function that moves them into the
> object is left ? Are they correctly freed when the object is freed ?
>
> I usually try to avoid handling strings in such a creative way.
>
>
> -Michael
>
> --
> ______________________________**_________________
> Lazarus mailing list
> Lazarus at lists.lazarus.**freepascal.org<Lazarus at lists.lazarus.freepascal.org>
> http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110923/e8b44a72/attachment-0003.html>


More information about the Lazarus mailing list