在Delphi-2010中,TThread.resume已被弃用,应该使用什么? [英] TThread.resume is deprecated in Delphi-2010 what should be used in place?

查看:2227
本文介绍了在Delphi-2010中,TThread.resume已被弃用,应该使用什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的多线程应用程序中

In my multithread application

我使用 TThread.suspend TThread.resume

自从将我的应用程序移动到Delphi 2010后,我得到以下交战消息

Since moving my application to Delphi 2010 I get the following warring message

[DCC Warning] xxx.pas(277 ):W1000符号'Resume'不推荐使用

如果Resume已被弃用,应该使用什么?

If Resume is deprecated what should be used in place?

编辑1:

我使用恢复命令来启动线程,因为它被创建为'CreateSuspended'设置为True和暂停之前,我终止线程。

I use the Resume command to start the thread - as it is Created with 'CreateSuspended' set to True and Suspend before I terminate the thread.

编辑2:

以下是delphi 2010手册的链接

推荐答案

Charles如果你阅读了TThread类的代码,你会找到答案。

Charles if do you read the code of TThread class , do you find the answer.

   TThread = class  
   private type  

..
..
..   
   public  
     constructor Create(CreateSuspended: Boolean);  
     destructor Destroy; override;  
     procedure AfterConstruction; override;  
     // This function is not intended to be used for thread synchronization.  
     procedure Resume; deprecated;  
     // Use Start after creating a suspended thread.  
     procedure Start;  
     // This function is not intended to be used for thread synchronization.  
     procedure Suspend; deprecated;  
     procedure Terminate;  

查看此链接
http://wings-of-wind.com/2009/ 08/28 / rad-studio-2010-community-pulse-the-day-after-part-2 /

编辑: strong>

如果需要同步线程,可以使用基于TMutex,TEvent和关键部分的方案。

If you need to synchronize threads, you can use a scheme based on TMutex, TEvent and critical sections.

再见。

这篇关于在Delphi-2010中,TThread.resume已被弃用,应该使用什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆