I've been trying to implement a thread that runs in the background and updates a progress bar every second or so and following the example in the top answer to Delphi - timer inside thread generates AV. I notice that the proposed solution has an implementation of TThread.FinishThreadExecution. My IDE shows that my version of delphi supports that method, but I've been unable to find any documentation on it (google turns up 10 hits, none of which help, http://docwiki.embarcadero.com/ doesn't list that method under TThread. What is it for and when is it called?
FinishThreadExecution
is not a method inherited from the TThread
base class. It is only a method implemented in the derived class, TTimerThread
.
The purpose of the method is to finish the execution of the thread in a proper way.
All FinishThreadExecution
does is to call Terminate
, which sets an internal flag in the TThread, plus sets the FTickEvent
event to wake the thread. The thread execute method will then end and the thread will self destruct, since TThread.FreeOnTerminate
is true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With