Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Erkennen ob Thread initialisirt ist? (https://www.delphipraxis.net/119081-erkennen-ob-thread-initialisirt-ist.html)

himitsu 21. Aug 2008 10:21

Re: Erkennen ob Thread initialisirt ist?
 
Delphi-Quellcode:
Type TThreads = packed Array of TThread;


Procedure RemoveThread(Var A: TThreads; Index: Integer);
  Begin
    If (Index < 0) or (Index >= Length(A)) Then Exit;
    //A[Index].Free;
    MoveMemory(@A[Index], @A[Index + 1],
      (High(A) - Index) * SizeOf(TThread));
    SetLength(A, High(A));
  End;
Free, falls das TThread-Objekt noch freigegeben werden muß

gandime 21. Aug 2008 12:59

Re: Erkennen ob Thread initialisirt ist?
 
hmm ich glaube ich rufe die Procedure falsch auf habs jetzt so gemacht:
Delphi-Quellcode:
removethread(TThreads(cs),i);
und nachdem die Procedure durchgelaufen ist length(cs)=0

himitsu 25. Aug 2008 07:54

Re: Erkennen ob Thread initialisirt ist?
 
wie ist den dein cs definiert?
(TThreads ist mehr nur als Beispiel gedacht und ebenso das .Free ist auf TThread ausgelegt und müßte eventuell angepaßt werden)

Code:
Type [color=#ff0000]{ArrayTyp}[/color] = packed Array of [color=#0000ff]{Typ}[/color];


Procedure RemoveThread(Var A: [color=#ff0000]{ArrayTyp}[/color]; Index: Integer);
  Begin
    If (Index < 0) or (Index >= Length(A)) Then Exit;
    [color=#df0000]//A[Index].Free;[/color]
    MoveMemory(@A[Index], @A[Index + 1],
      (High(A) - Index) * SizeOf([color=#0000ff]{Typ}[/color]));
    SetLength(A, High(A));
  End;


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:45 Uhr.
Seite 2 von 2     12   

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