为什么我的线程执行时整个程序都死机,在线求救
asphp 2003-03-02 12:45:00 在TBackgroundCommThread中有
bool __fastcall TBackgroundCommThread::WaitResponse(double sec)
{
bool Cg=StatusCg;
Suspend();
time_t tm_start=time(NULL);
for (;difftime(time(NULL),tm_start)<sec;)
{
recvstr();
if(Cg!=StatusCg)//mobile have response
{
while (Suspended)
Resume();
return true;
}
this->WaitFor();
//receivestr
}
while (Suspended)
Resume();
return false;
}
rcvstr是没有问题的,for循环一开始就死机了,如execute函数则不死机
void __fastcall TBackgroundCommThread::Execute()
{
while (!Terminated)
{
recvstr();
// Sleep for a period of time, and then wake up and check the port again.
Sleep(100);
}
}
求解!!!