【windowsスレッド】スレッドリソースの作成と解放


  AfxBeginThread 
 
  
CWinThread* AfxBeginThread(
   AFX_THREADPROC pfnThreadProc,
   LPVOID pParam,
   int nPriority = THREAD_PRIORITY_NORMAL,
   UINT nStackSize = 0,
   DWORD dwCreateFlags = 0,
   LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL 
);
 
  
Tips:
1          ,          ,     ,         CWinthread       。
2      CloseHandle CWinthread->m_hThread,    delete CWinthread*,       
3     m_bAutoDelete=False,    delete CWinthread*             ,       CloseHandle。

    :       : 0xC0000008: An invalid handle was specified
 
  
    
    AfxEndThread 
        GetExitCodeThread 2   。
1、   m_bAutoDelete    ,              
2、The safest way to do this is to pass CREATE_SUSPENDED to AfxBeginThread, store the handle, and then resume the thread by calling ResumeThread
       ::DuplicateHandle       handle。       CloseHandle      。          。