[fpc-pascal] What's the deal with CloseThread?

Anthony Walter sysrpl at gmail.com
Tue Apr 23 22:40:32 CEST 2013


Thanks for so much Sven. I have another question.

Is it okay for a thread to close itself before it's finished? Because I
believe that is what happens when FreeOnTerminate is set to True. Here is a
brief synopsis of what can execute:

In rtl/objpas/classes/classes.inc

Line 168: FreeThread := Thread.FFreeOnTerminate; // captures free on
termiante
Line 173: Thread.Free; // invokes the destructor from within the thread
Line 197: CloseThread(FHandle); // thread is closed in destructor
TThread.Destroy;
Line 174: EndThread(Result); // flow returns here, but the thread was
already closed

So what it looks like is that we expect code inside a thread continue
running after it has been closed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130423/8b7bfa85/attachment.html>


More information about the fpc-pascal mailing list