📄 psithreadmgrdefault.pas
字号:
unit PsiThreadMgrDefault;
//******************************************************************************
// The original software is under
// Copyright (c) 1993 - 2000, Chad Z. Hower (Kudzu)
// and the Indy Pit Crew - http://www.nevrona.com/Indy/
//
// Amended : November 2000, by Michael M. Michalak MACS for use with
// MorphTek.com Inc Peer to Peer Open Source Components - http://www.morphtek.com
//
//******************************************************************************
interface
uses
PsiThread, PsiThreadMgr;
type
TPsiThreadMgrDefault = class(TPsiThreadMgr)
public
function GetThread: TPsiThread; override;
procedure ReleaseThread(AThread: TPsiThread); override;
end;
implementation
uses
PsiGlobal;
{ TPsiThreadMgrDefault }
function TPsiThreadMgrDefault.GetThread: TPsiThread;
begin
result := CreateNewThread;
Lock.Enter; try
ActiveThreads.Add(result);
finally Lock.Leave; end;
end;
procedure TPsiThreadMgrDefault.ReleaseThread(AThread: TPsiThread);
begin
if not IsCurrentThread(AThread) then begin
AThread.TerminateAndWaitFor;
AThread.Free;
end else begin
AThread.FreeOnTerminate := True;
end;
Lock.Enter; try
ActiveThreads.Remove(AThread);
finally Lock.Leave; end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -