AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi IdTCPServer: RSTerminateThreadTimeout (Terminate Thread ...)
Thema durchsuchen
Ansicht
Themen-Optionen

IdTCPServer: RSTerminateThreadTimeout (Terminate Thread ...)

Ein Thema von Puhbaehr · begonnen am 16. Nov 2005 · letzter Beitrag vom 18. Nov 2005
Antwort Antwort
Seite 2 von 2     12   
hardy1234

Registriert seit: 8. Aug 2004
Ort: Hamburg
26 Beiträge
 
Delphi 7 Enterprise
 
#11

Re: IdTCPServer: RSTerminateThreadTimeout (Terminate Thread

  Alt 18. Nov 2005, 07:05
Pardon

while THread.Count > 0 do begin
Es gibt keinen schöneren Tag als den heutigen. Der gestrige ist vorbei und von den kommenden weiß man nicht was sie bringen.
  Mit Zitat antworten Zitat
Puhbaehr
(Gast)

n/a Beiträge
 
#12

Re: IdTCPServer: RSTerminateThreadTimeout (Terminate Thread

  Alt 18. Nov 2005, 07:19
Mh...

Hatte ich nicht erwähnt, dass...

Zitat von Puhbaehr:
...hier (in der Unit IdTCPServer) in dieser Prozedur:

Delphi-Quellcode:
procedure TIdTCPServer.TerminateAllThreads;
const
  LSleepTime: Integer = 250;
var
  i: Integer;
  LThreads: TList;
  LTimedOut: Boolean;
begin
  // Threads will be nil if exception happens during start up, such as trying to bind to a port
  // that is already in use.
  if Assigned(Threads) then begin
    // This will provide us with posibility to call AThread.Notification in OnDisconnect event handler
    // in order to access visual components. They can add notifications after the list has been
    // unlocked, and before/while TerminateThreads is called
    LThreads := Threads.LockList; try
      for i := 0 to LThreads.Count - 1 do begin
        with TIdPeerThread(LThreads[i]) do begin
          Connection.DisconnectSocket;
        end;
      end;
    finally Threads.UnlockList; end;
    // Must wait for all threads to terminate, as they access the server and bindings. If this
    // routine is being called from the destructor, this can cause AVs
    //
    // This method is used instead of:
    // -Threads.WaitFor. Since they are being destroyed thread. WaitFor could AV. And Waiting for
    // Handle produces different code for different OSs, and using common code has troubles
    // as the handles are quite different.
    // -Last thread signaling
    // ThreadMgr.TerminateThreads(TerminateWaitTime);

    if not TIdThreadSafeList(Threads).IsCountLessThan(1) then begin
      LTimedOut := True;
      for i := 1 to (TerminateWaitTime div LSleepTime) do begin
        Sleep(LSleepTime);
        if TIdThreadSafeList(Threads).IsCountLessThan(1) then begin
          LTimedOut := False;
          Break;
        end;
      end;
      if LTimedOut then begin      
        raise EIdTerminateThreadTimeout.Create(RSTerminateThreadTimeout);   // <-- hier
      end;
    end;
  end;
End;//TerminateAllThreads
...
Indy-Version: 9
...die Prozedur TerminateAllThreads in der Unit TIdTCPServer zu der Indy-TCPServer-Komponente dazu gehört? Sorry
Deswegen habe ich nicht wirklich Einfluss darauf.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:43 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