我创建了一个线程,用于Socket监听
CWinThread *pThread;
pThread = AfxBeginThread(Listen,(LPVOID)tis,THREAD_PRIORITY_NORMAL,0,0);但是使用
pThread->SuspendThread;
却无法挂起线程,还是能够正常的监听连接,执行线程内代码
这是怎么回事???
怎么终止这个线程(无法暂停我就干掉它)???

解决方案 »

  1.   

    pThread->SuspendThread能不能执行到?
      

  2.   

    hThread 
    [in] Handle to the thread that is to be suspended. 
    The handle must have the THREAD_SUSPEND_RESUME access right. For more information, see Thread Security and Access Rights.只有带有 THREAD_SUSPEND_RESUME 访问权限的线程才能够被挂起
      

  3.   

    这个问题我碰到过,有侦听SOCKET的线程被阻塞了,如果你要强行关闭的话可以TerminateThread