Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Indy 9 -> Indy 10 Hilfe (https://www.delphipraxis.net/172807-indy-9-indy-10-hilfe.html)

Shark99 23. Jan 2013 20:05

Indy 9 -> Indy 10 Hilfe
 
Hallo!

Ich bin Dabei eine Anwendung von Indy 9 auf Indy 10 umzuschreiben.

Ist ein ziemlicher Kampf. Ich kam trotzdem einigermassen weit, aber nun stecke ich fest und mein Freund Google ist auch keine Hilfe.

Hier ist der Indy 9 Code:
Ein Thread Pool mit einer einstellbaren Anzahl von Threads wird erstellt, und diese Threads dann gestartet
(die Threads selbst führen ein Get() vom Indy HTTP Clients aus, aber das spielt hier keine Rolle).
Delphi-Quellcode:
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;
Die Klasse TIdThreadMgrPool ist mit Indy 10 leider Geschichte.

Ich habe nach Ersatz gesucht, und auf dem ersten Blick scheint TIdSchedulerOfThreadPool
passend zu sein. Allerdings finde ich kein Beispiel dazu.

Wenn ich es so versuche
Delphi-Quellcode:
  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;
gibt es hier ein Problem:
Delphi-Quellcode:
procedure TIdTask.DoBeforeRun;
begin
  FBeforeRunDone := True;
  BeforeRun;
end;
und zwar access violation bei FBeforeRunDone.


Bin dankbar für jegliche Hilfe!


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:44 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz