请问我这段关于线程的代码有什么问题?
type
Myzhiling = record
command: Integer;
end;
ClientInfo = record
PcName:string[5];//名称
passwd:string[20];//密码
command:string[5];//指令
Ver:string[2]; //版本
Text:string; //附加信息
end;
TMyThread = class(TThread)
private
F_info:ClientInfo;
F_Athread: TIdPeerThread;
protected
procedure DoTerminate; override;
public
constructor Create(C_info:ClientInfo; const C_Athread: TIdPeerThread);
destructor Destroy; override;
procedure Execute; override;
end;
implementation
uses main;
{ TCheckThread }
constructor TMythread.Create(C_info:ClientInfo; const C_Athread: TIdPeerThread);
begin
inherited Create(False);
FreeOnTerminate := True;
F_info:=C_info;
F_Athread := C_Athread;
end;
destructor Tmythread.Destroy;
begin
inherited Destroy;
end;
procedure TMythread.DoTerminate;
begin
inherited DoTerminate;
end;
procedure TMythread.Execute;
begin
with Form1 do
begin
EnterCriticalSection(cs);
if F_info.command='ADD'then
begin
form1.listview1.items.add................
end;
LeaveCriticalSection(cs);
Terminate;
end;
//=========================
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
C_info:ClientInfo;
begin
// if (not AThread.Terminated) and (AThread.Connection.Connected=True) then
begin
AThread.Connection.ReadBuffer(C_info,SizeOf(C_info));
TMyThread.Create(C_info,AThread);
end;
end;