В данном примере я получаю исключение при вызове AThread.Free.
program Project44;
{$APPTYPE CONSOLE}
uses
SysUtils, Classes, Windows;
type
TMyException = class(Exception);
var
AThread: TThread;
begin
AThread := TThread.Create(True);
try
AThread.FreeOnTerminate := True;
//I want to do some things here before starting the thread
//During the setup phase some exception might occur, this exception is for simulating purpouses
raise TMyException.Create('exception');
except
AThread.Free; //Another exception here
end;
end.
У меня два вопроса:
Как мне освободить экземпляр AThread
для TThread
в данном примере?
Я не понимаю, почему TThread .Destroy
вызывает Resume
перед самоуничтожением. В чем смысл этого?