目录
一、需求:
1、因为写线程的时候,Sleep是整个工程都停住了,所以需要一个只是暂停当前线程的方法
二、参考网页:
https://blog.csdn.net/weixin_39345003/article/details/90899556
三、代码:
头文件中定义句柄
HANDLE m_handle = INVALID_HANDLE_VALUE;
初始化时候创建一下
m_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
再一些线程里面将其挂起
void ThreadPro(void * pArguments)
{
CLiftDlg* pThis = (CLiftDlg*)pArguments;
pThis->m_lr = new CLiftRun();
while (b_keeping)
{
pThis->m_lr->Process();
WaitForSingleObject(pThis->m_handle, 1);
}
delete pThis->m_lr;
}