:: :: 博问 :: 闪存 :: :: 联系 :: :: 管理 ::

 

结束线程的处理方法:
        SetEvent(hRequestExitEvent);
    
    
int nCount = vctr_sWebCheck.size();

    HANDLE
* arrayThread = new HANDLE[nCount];   

    
for (size_t i = 0; i < nCount ; ++i)
    {
        arrayThread[i] 
= vctr_hWinThread[i]->m_hThread;
    }
    TRACE(_T(
"success initialed"));
    WaitForMultipleObjects(nCount, arrayThread, TRUE, INFINITE);

    
for (int n = 0; n < nCount; ++n)
    {
        CloseHandle(arrayThread[n]);
    }

    delete []arrayThread;
    ResetEvent(hRequestExitEvent);


注意 ResetEvent(hRequestExitEvent);

vctr_hWinThread.clear();
    hRequestExitEvent 
= CreateEvent(NULL, TRUE, FALSE, NULL);
    OnGetCheckWebInfo(
00);
    size_t nCount 
= vctr_sWebCheck.size();
    
for (size_t i = 0; i < nCount; ++i)
    {
        
// hWebCheckWnd = this->m_hWnd;
        vctr_hWinThread.push_back(AfxBeginThread(McThreadCheckWeb, &vctr_sWebCheck[i])) ; 
    }
注意初始化:
hRequestExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
posted on 2006-08-11 15:16  dtor  阅读(197)  评论(0编辑  收藏  举报