|
我在c++ builder下进行ace开发,采用ACE_Task<ACE_MT_SYNCH>多线程方式,在客户端没有断开连接的情况下,我关闭窗体,ACE_Task的wait()方法一直处于等待,导致窗体不能关闭,请问如何解决?请高手们知道。
int MyTask::stop (void)
{
ACE_DEBUG ((LM_DEBUG,ACE_TEXT (" (%t) MyTask::stop\n")));
ACE_Log_Msg::instance()->clr_flags (ACE_Log_Msg::MSG_CALLBACK);
if (this->my_reactor_ != 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("End TP_Reactor event loop\n")));
ACE_Reactor::end_event_loop ();
}
if (this->wait () == -1) //就是这个地方一直在等待
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p.\n"),
ACE_TEXT ("unable to stop thread pool")));
if (this->delete_reactor () == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p.\n"),
ACE_TEXT ("unable to delete reactor")));
return 0;
} |
|