首页 > 其他 > 详细

indy9在程序关闭时出现terminate thread timeout的BUG解决办法

时间:2017-04-14 14:29:49      阅读:244      评论:0      收藏:0      [点我收藏+]

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解决办法

原文:http://www.cnblogs.com/hnxxcxg/p/6708480.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!