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.