[英]What is the purpose of TThread.FinishThreadExecution, and when is it called?
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 . 我一直在尝试实现一个在后台运行的线程并每隔一秒钟更新一个进度条,然后按照Delphi的顶级答案中的示例- 在线程内部的计时器生成AV 。 I notice that the proposed solution has an implementation of TThread.FinishThreadExecution. 我注意到建议的解决方案有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? 我的IDE显示我的delphi版本支持该方法,但我一直无法找到它的任何文档(谷歌出现10次点击,没有一个帮助, http://docwiki.embarcadero.com/没有列出TThread下的那个方法。它的用途是什么,什么时候被称为?
FinishThreadExecution
is not a method inherited from the TThread
base class. FinishThreadExecution
不是从TThread
基类继承的方法。 It is only a method implemented in the derived class, TTimerThread
. 它只是派生类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. 所有FinishThreadExecution
都会调用Terminate
,它在TThread中设置一个内部标志,并设置FTickEvent
事件以唤醒线程。 The thread execute method will then end and the thread will self destruct, since TThread.FreeOnTerminate
is true. 然后线程执行方法将结束并且线程将自毁,因为TThread.FreeOnTerminate
为真。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.