좀 스레딩 관련 코드를 읽고 코드의이 작품을 찾았습니다/MFC는
MyThread::start()
{
//Create a thread
m_pThread = AfxBeginThread(/*some parameters*/)
//Create a duplicate handle for the created thread
m_hDuplicateHandle = DuplicateHandle(/* some more parameters*/)
}
MyThread::stop()
{
//Set some variables so that the thread comes out of its run() function
WaitForSingleObject(m_hDuplicateHandle, defaultTimeout);
CloseHandle(m_hDuplicateHandle);
}
내 질문, 중복 핸들이 필요합니다 왜? 원래 스레드 핸들에서 직접 대기 할 수는 없습니까? 어떻게 든 무효가됩니까?