मैं, इंडी 10प्रवास के, TIdSchedulerOfThreadPool प्रारंभ
यह काफी दर्दनाक है करने के लिए इंडी 9 से एक डेल्फी ऐप्लिकेशन को अपडेट करने की प्रक्रिया में हूँ के रूप में जाहिरा तौर पर बहुत बदल गया है।
मैं एक कदम पर अटक गया हूं।
यहाँ पुराने कोड (के साथ काम करने इंडी 9) है:
एक धागा पूल बनाया गया है और पूल के हर धागा आरंभ नहीं हो जाता है और फिर शुरू कर दिया। व्यक्तिगत थ्रेड एक इंडी http क्लाइंट बनाते हैं (लेकिन इससे कोई फर्क नहीं पड़ता)।
TUrlThread = class(TIdThread)
...
var
i: Integer;
begin
// create the Pool and init it
Pool := TIdThreadMgrPool.Create(nil);
Pool.PoolSize := Options.RunningThreads;
Pool.ThreadClass:= TUrlThread;
// init threads and start them
for i := 1 to Options.RunningThreads do
begin
with (Pool.GetThread as TUrlThread) do
begin
Index := i;
Controler := Self;
Priority := Options.Priority;
Start;
end;
end;
TIdThreadMgrPool वर्ग इंडी 10
मैं एक प्रतिस्थापन और TIdSchedulerOfThreadPool एक विजेता, की तरह दिखता है, लेकिन मैं यह नहीं चल रहा प्राप्त कर सकते हैं के लिए देखा है के साथ चला गया है।
यहाँ संशोधित (इंडी 10) कोड है:
TUrlThread = class(TIdThreadWithTask)
...
var
i: Integer;
begin
// create the Pool and init it
Pool := TIdSchedulerOfThreadPool.Create(nil);
Pool.PoolSize := Options.RunningThreads;
Pool.ThreadClass:= TUrlThread;
// init threads and start them
for i := 1 to Options.RunningThreads do
begin
with (Pool.NewThread as TUrlThread) do
begin
Index := i;
Controler := Self;
Priority := Options.Priority;
Start;
end;
end;
मैं एक पहुँच उल्लंघन अपवाद यहाँ प्राप्त (इस इंडी कोड है):
procedure TIdTask.DoBeforeRun;
begin
FBeforeRunDone := True;
BeforeRun;
end;
FBeforeRunDone नहीं के बराबर है।