标签:server stop item nec 关闭 end begin exce 解决
indy9在程序关闭时出现terminate thread timeout的BUG解决办法
INDY9线程有BUG,在退出程序的时候会报错:terminate thread timeout(终止线程超时)。
解决办法:
procedure TForm1.DisconnectAll;
var
List: TList;
I: Integer;
begin
List := IdTCPServer1.Threads.LockList;
try
for I := 0 to List.Count - 1 do
begin
try
TIdPeerThread(List.Items[I]).Connection.Disconnect;
except
on E: Exception do
begin
TIdPeerThread(List.Items[I]).Stop;
end;
end;
end;
finally
IdTCPServer1.Threads.UnlockList;
end;
end;
DisconnectAll; // 先执行
IdTCPServer1.Active := False;
indy9在程序关闭时出现terminate thread timeout的BUG解决办法
标签:server stop item nec 关闭 end begin exce 解决
原文地址:http://www.cnblogs.com/hnxxcxg/p/6708480.html