在给定的示例中,我在调用时收到异常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
。这有什么意义?