L
lotuscheng2
Unregistered / Unconfirmed
GUEST, unregistred user!
Button_open //建立一个线程
newthread:=threadconnect.Create;
Button_close //关闭线程
idtcpclient1.Disconnect ; //关闭Client
newthread.Terminate ; //结束线程 .
procedure ThreadConnect.Execute; //线程
var msg:string;
begin
freeonterminate:=true;
while not (Terminated ) and form1.IdTCPClient1.Connected do
begin
msg:=form1.IdTCPClient1.ReadLn();
if msg<>'' then //出错了..
begin
end;
end;
end;
当执行关闭线程newthread.Terminate后程序跳到if msg<>'' then出错,信息如下:Class EidReadTimeOut with message 'read timeout'
newthread:=threadconnect.Create;
Button_close //关闭线程
idtcpclient1.Disconnect ; //关闭Client
newthread.Terminate ; //结束线程 .
procedure ThreadConnect.Execute; //线程
var msg:string;
begin
freeonterminate:=true;
while not (Terminated ) and form1.IdTCPClient1.Connected do
begin
msg:=form1.IdTCPClient1.ReadLn();
if msg<>'' then //出错了..
begin
end;
end;
end;
当执行关闭线程newthread.Terminate后程序跳到if msg<>'' then出错,信息如下:Class EidReadTimeOut with message 'read timeout'