Thema: Delphi Indy 9 -> Indy 10 Hilfe

Einzelnen Beitrag anzeigen

Shark99

Registriert seit: 16. Mai 2007
403 Beiträge
 
#1

Indy 9 -> Indy 10 Hilfe

  Alt 23. Jan 2013, 20:05
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!

Geändert von Shark99 (23. Jan 2013 um 20:44 Uhr)
  Mit Zitat antworten Zitat