Skip to content

Instantly share code, notes, and snippets.

@xingfuqiu
Created February 20, 2012 07:54
Show Gist options
  • Save xingfuqiu/1868319 to your computer and use it in GitHub Desktop.
Save xingfuqiu/1868319 to your computer and use it in GitHub Desktop.
Delphi:通用多线程类
unit uThread;
interface
uses
Classes;
type
TFun = procedure of object;
type
TFunThread = class(TThread)
fun: TFun;
private
{ Private declarations }
protected
procedure Execute; override;
public
constructor Create(AFun: TFun);
end;
implementation
constructor TFunThread.Create(AFun: TFun);
begin
inherited Create(False);
FreeOnTerminate := True;
Priority := tpLower;
fun := AFun;
end;
procedure TFunThread.Execute;
begin
fun;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment