, TIdSchedulerOfThreadPool Indy 10 TIdThreadMgrPool. , , , TIdScheduler TIdThreadMgr.
Indy 10, TIdThreadWithTask . , TIdThreadWithTask , TIdTask - (, TIdContext, Indy 10 TIdPeerThread), . , , . Start() , TIdTask TIdThreadWithTask.Task. TIdTCPServer , TIdScheduler.AcquireYarn() TIdYarn, TIdThreadWithTask, TIdContext TIdScheduler.StartYarn(), TIdYarn TIdThreadWithTask, Task, Start() .
. Indy 9 10 TIdThread.Start() . TIdTCPServer , ThreadMgr/Scheduler . , , . , .
:
TUrlThread = class(TIdThread)
...
var
i: Integer;
begin
// create the Pool and init it
Pool := TIdThreadMgrPool.Create(nil);
Pool.PoolSize := Options.RunningThreads;
Pool.ThreadClass:= TUrlThread;
Pool.ThreadPriority := Options.Priority;
// init threads and start them
for i := 1 to Options.RunningThreads do
begin
with (Pool.GetThread as TUrlThread) do
begin
Index := i;
Controler := Self;
end;
end;
.
TUrlThread = class(TIdThreadWithTask)
...
var
i: Integer;
begin
// create the Pool and init it
Pool := TIdSchedulerOfThreadPool.Create(nil);
Pool.PoolSize := Options.RunningThreads;
Pool.ThreadClass:= TUrlThread;
Pool.ThreadPriority := Options.Priority;
// init threads and start them
for i := 1 to Options.RunningThreads do
begin
with (Pool.NewThread as TUrlThread) do
begin
Index := i;
Controler := Self;
end;
end;
, , , . Indy 9, 10, . PoolSize - , . PoolSize , , , . TUrlThread. Controler -, . Index , .
, . TIdThreadMgrPool.GetThread() TIdSchedulerOfThreadPool.NewThread() . Indy 9 10, , , Indy 10 TIdTCPServer. , , . , , , .