Thread, new start and deprecated resume
As you already may know, from Delphi 2010 Resume and Suspend methods of TThread class are deprecated. In other hand, a thread that is created as suspended needs a way to be resumed and because of that the new Start method is introduced.
However, when I call Start method on a thread that is created as suspended, an exception complains that the thread is not suspended and then cannot be started.
Sample code
Could somebody please help me to get out of this confusion?
However, when I call Start method on a thread that is created as suspended, an exception complains that the thread is not suspended and then cannot be started.
Sample code
- Code: Select all
constructor MyThread.create;
begin
inherited Create(true);
FreeOnTerminate := true;
Start; // the exception occurs here. if I use resume, no exception occurs, but deprecation message.
end;
Could somebody please help me to get out of this confusion?