HANDLE m_hThread;
HANDLE m_hQuitEvent;
static unsigned __stdcall ProcessData (LPVOID pParam);
m_hQuitEvent = CreateEvent( NULL,TRUE,FALSE,NULL );
m_hThread =
(HANDLE)_beginthreadex(NULL, // Security
0, // Stack size - use default
ProcessData, // Thread fn entry point
(void*) this,
0, // Init flag
NULL);
SetEvent( m_hQuitEvent );
unsigned __stdcall CQyPostInfoCtrl::ProcessData(LPVOID pParam)
{
if (pCtrl == NULL)
{
return FALSE;
}
while(TRUE)
{
DWORD dwWaitResult = WaitForSingleObject(pCtrl->m_hQuitEvent,1000);
switch (dwWaitResult)
{
case WAIT_OBJECT_0:
return 1;
case WAIT_TIMEOUT:
break;
}
}
}
c++ thread event
需积分: 32 138 浏览量
2010-11-25
23:28:34
上传
评论
收藏 510B RAR 举报
zhangxiaonanwin
- 粉丝: 60
- 资源: 21