Delphi – TThread.resume is deprecated in Delphi-2010 what should be used in place

delphidelphi-2010

In my multithread application

I use TThread.suspend and TThread.resume

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

[DCC Warning] xxx.pas(277): W1000 Symbol ‘Resume’ is deprecated

If Resume is deprecated what should be used in place?

EDIT 1:

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.

EDIT 2:

Here is a link the delphi 2010 manual

Best Answer

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;  

See this link RAD Studio 2010: Community pulse: The day after. (Part 2)

Edit:

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

Bye.

Related Topic