[Lazarus] Thread finalization

Frank Church vfclists at gmail.com
Tue Oct 4 12:35:21 CEST 2011


On 21 September 2011 15:41, Leonardo M. Ramé <l.rame at griensu.com> wrote:

> On 2011-09-21 16:28:45 +0200, Mattias Gaertner wrote:
> > On Wed, 21 Sep 2011 11:12:12 -0300
> > Leonardo M. Ramé <l.rame at griensu.com> wrote:
> >
> > > On 2011-09-21 15:38:08 +0200, cobines wrote:
> > >[...]
> > > Well, the "best" way I found is to create a Timer that checks if the
> > > thread is terminated, then destroy it.
> > >
> > > I don't like this. It would be better if the thread can communicate the
> > > main form that it has finished, then the main form can destroy it,
> > > without using a Timer.
> >
> > Why must the main thread destroy it? The thread can destroy itself.
> > Just add a Synchronize call in the destructor or at the end of Execute to
> let the main thread clear the references.
> >
> > Mattias
> >
>
> So, you say that I should use FreeOnTerminate := true, and set MyThread
> := nil on the main thread?.
> --
> Leonardo M. Ramé
> http://leonardorame.blogspot.com
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>


How you found a  way of resolving your problem?

I suspect I will be interested in this issue soon.
-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111004/ca358881/attachment-0002.html>


More information about the Lazarus mailing list