简体   繁体   English

TThread.FinishThreadExecution的目的是什么,什么时候被调用?

[英]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.

相关问题 TThread.Execute没有按预期方式被调用 - TThread.Execute is not called as expected 使用TTimer和使用TThread有什么区别 - What is the difference between using TTimer and using TThread TThread和COM-“未调用CoInitialize”,尽管在构造函数中已调用CoInitialize - TThread and COM - “CoInitialize has not been called”, although CoInitialize is called in the constructor TThread :: Synchronize()>读取表单组件属性时? - TThread::Synchronize() > when reading Form component properties? 我什么时候需要在TThread中同步? - When do I need synchronize in TThread? 同步运行任务的目的是什么,何时执行? - what is the purpose of running task synchronously and when to do it? 使用TThread与UI线程通信时如何避免使用计时器 - How to avoid use of timer when using TThread to communicate with UI thread 与Queue一起使用时,“线程”列表变量的用途是什么 - What is the purpose of “threads” list variable when used with Queue 调用 exec() 时线程会发生什么? - What happens to threads when exec() is called? 我可以将Delphi TThread.Synchronize()本地移动到VCL表单以从主线程或工作线程调用吗? - Can I move Delphi TThread.Synchronize() locally to a VCL form to be called from both a main or worker thread?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM