unit uThread;
interface
uses
Classes,SysUtils;
Type
//Tfun = procedure;
Tfun = procedure of object;
TFunThread =Class(TThread)
private
fun:Tfun;
protected
procedure Execute;override;
public
Constructor Create(Afun:Tfun);
Destructor Destroy;override;
end;
implementation
constructor TFunThread.Create(Afun: Tfun);
begin
inherited Create(true);
FreeOnTerminate :=true;
fun:=aFun;
Resume;
end;
destructor TFunThread.Destroy;
begin
end;
procedure TFunThread.Execute;
begin
fun;
end;
end.