在线程里面
while not Terminated do
begin
……
try
FIdTCPClient.Disconnect;
FIdTCPClient.Connect(FConnectTimeOut);
finally
end;
……
end;
出错以后线程就死掉了。
改成except就可以了。
奇怪!!!
博客讲述了线程中使用while循环,在try语句块里执行FIdTCPClient的断开和连接操作,出错后线程会死亡。将其改成except后问题得到解决,体现了线程出错处理方式的重要性。
在线程里面
while not Terminated do
begin
……
try
FIdTCPClient.Disconnect;
FIdTCPClient.Connect(FConnectTimeOut);
finally
end;
……
end;
出错以后线程就死掉了。
改成except就可以了。
奇怪!!!
741
1万+

被折叠的 条评论
为什么被折叠?
