CEvent g_eventStart; CEvent g_eventKill; ... UINT ThreadProc(LPVOID pParam) { ::WaitForSingleObject(g_eventStart.m_hObject, INFINITE); CWnd* pWnd = CWnd::FromHandle((HWND)pParam); // Working Loop DWORD startTime = timeGetTime(); while (working) { working = finder.FindNextFileW(); if (!(finder.IsDots() || finder.IsCompressed() || finder.IsSystem() || finder.IsTemporary())) { ... } if (::WaitForSingleObject(g_eventKill.m_hObject, 0) == WAIT_OBJECT_0) return; } } DWORD elapsedTime = timeGetTime(); // End Work ::PostMessage((HWND)pParam, WM_THEMECHANGED, 0, 0); return 0; }
MFC
동기화
스레드
이벤트
Retrieved from http://hyacinth.byus.net/moniwiki/wiki.php/C++/(MFC)워커 스레드와 이벤트를 이용한 동기화
last modified 2011-04-06 10:52:19