Autor Beitrag
reg107
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 36



BeitragVerfasst: Sa 02.04.05 11:58 
Hallo,
wie kann ich einen Thread mehrmals aufrufen (~100 mal). Es soll dann immer eine Variable übergeben werden.
Das, was der Thread macht, dauert nämlich länger, sodass die Threads gleichzeitig ablaufen werden.

Grüße,
reg107


Moderiert von user profile iconGausi: Topic aus VCL (Visual Component Library) verschoben am So 03.04.2005 um 17:30
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Sa 02.04.05 12:03 
Moin,

versuchs mal z.B. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var i : Integer; 
    ProzID : Array [1..100] of Cardinal;
    VariablenListe : Array [1..100] of String;
begin
 for i := 1 to 100 do
  begin
   CreateThread(0, 0, @DeinThread(Variablenliste[i]), nil, 0, ProzID[i]);
  end;
end;
reg107 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 36



BeitragVerfasst: Sa 02.04.05 12:20 
wie definiere (ka, ob das so heißt) ich dann den thread?
bis jetzt hab ich das immer so gemacht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
...
  private
    { Private-Deklarationen }
    MyThread: TThread;
  public
    { Public-Deklarationen }
  end;

  TMyThread = class(TThread)
  protected
    procedure Execute; override;
  end;
...
procedure TMyThread.Execute;
...

wenn ich jetzt aus Execute; einfach Execute(s:string); mache, bekomme ich die fehlermeldung:
[Fehler] Unit1.pas(43): Deklaration von 'Execute' unterscheidet sich von vorheriger Deklaration