加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

TThread.resume在Delphi-2010中不推荐使用什么应该使用到位?

发布时间:2020-12-15 05:23:38 所属栏目:大数据 来源:网络整理
导读:在我的多线程应用程序中 我使用TThread.suspend和TThread.resume 自从将我的应用程序移至Delphi 2010之后,我得到了下面的交战消息 [DCC警告] xxx.pas(277):W1000不推荐使用符号’Resume’ 如果Resume被弃用,应该使用什么? 编辑1: 我使用Resume命令启动
在我的多线程应用程序中

我使用TThread.suspend和TThread.resume

自从将我的应用程序移至Delphi 2010之后,我得到了下面的交战消息

[DCC警告] xxx.pas(277):W1000不推荐使用符号’Resume’

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

编辑1:

我使用Resume命令启动线程 – 因为它是创建与’CreateSuspended’设置为真和暂停在我终止线程。

编辑2:

Here is a link the delphi 2010 manual

解决方法

Charles如果你读了TThread类的代码,你会找到答案。
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/

编辑:

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

再见。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读