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." So the user could do sth. like LazLoggerObj.RegisterThread(<thread handle or ID>); in the construction code of his threads. So you know the threads using the logger. Same could be done in the destruction code, using the ".DeregisterThread()" method. So you now the threads and their lifetime inside the logger. HTH anyhow, Marc -- Marc Santhoff <m.santh...@web.de> _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal