H
hellenlong
Unregistered / Unconfirmed
GUEST, unregistred user!
触发线程PostThreadMessage(mParseThread.ThreadID,WM_PARSE,0,0)
以下为线程执行体
procedure TParseCommandThread.Execute;
var
Amsg:Msg;
commandCode:Integer;
mem:TMemoryStream;
begin
inherited;
{待调试}
while (not terminated)do
begin
GetMessage(AMsg,0,0,0);
case AMsg.message of
WM_PARSE:
begin
while mCommandList.Count >= 1do
begin
if PCommand(mCommandList[0]).IsOk then
begin
commandCode := PCommand(mCommandList[0])^.CommandCode;
mem := PCommand(mCommandList[0])^.mem;
case commandCode of
1001:
ParseCommand1001(mem);
2001:
ParseCommand2001(mem);
3001:
ParseCommand3001(mem);
end;
mem.Free;
mCommandList.Delete(0);
end
else
Break;
end;
end;
WM_TERMINATE:Terminate;
end;
end;
end;
我现在改用上段程序来处理Socket.Onread时指令的顺序执行。
但是,一直获得AMsg.message=15,于是程序进入死循环?但是,我并没有发送这个消息啊,还有我在线程中发消息给其他线程,会不会有问题呢?
各位请帮我看看
以下为线程执行体
procedure TParseCommandThread.Execute;
var
Amsg:Msg;
commandCode:Integer;
mem:TMemoryStream;
begin
inherited;
{待调试}
while (not terminated)do
begin
GetMessage(AMsg,0,0,0);
case AMsg.message of
WM_PARSE:
begin
while mCommandList.Count >= 1do
begin
if PCommand(mCommandList[0]).IsOk then
begin
commandCode := PCommand(mCommandList[0])^.CommandCode;
mem := PCommand(mCommandList[0])^.mem;
case commandCode of
1001:
ParseCommand1001(mem);
2001:
ParseCommand2001(mem);
3001:
ParseCommand3001(mem);
end;
mem.Free;
mCommandList.Delete(0);
end
else
Break;
end;
end;
WM_TERMINATE:Terminate;
end;
end;
end;
我现在改用上段程序来处理Socket.Onread时指令的顺序执行。
但是,一直获得AMsg.message=15,于是程序进入死循环?但是,我并没有发送这个消息啊,还有我在线程中发消息给其他线程,会不会有问题呢?
各位请帮我看看