[fpc-pascal] Question: Is there a global callback, when a thread gets terminated?

Sven Barth pascaldragon at googlemail.com
Tue Feb 12 17:36:01 CET 2019


Am Di., 12. Feb. 2019, 16:56 hat Marc Santhoff <M.Santhoff at web.de>
geschrieben:

> On Mon, 2019-02-11 at 10:21 +0000, Michael Schnell wrote:
> > > Yes, but how do I get notified, when the thread is gone, and I can free
> > > the
> > > memory (of the object that was created)?
> >
> > Ah, now I finally see the problem :)
> >
> > The only idea that comes in my mind is creating yet another thread or a
> > TTimer (by means of "QueueAsyncCall") to poll if the original Threads
> still
> > living. This supposedly would involve OS calls for getting the thread ID
> and
> > for checking same for validity. Ugly ! :( .
>
> If the LazLogger user has to put debugln() statements in his code, me
> thinks
> it would be an acceptable price to tell him:
>
> "If you are using debugln() inside threads, let each thread register with
> the
> logger before first usage."
>

Not every LazLogger user knows that their code is run in a thread. And not
every thread user knows that the code they are using is using LazLogger in
turn.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190212/b0b8fc59/attachment.html>


More information about the fpc-pascal mailing list