KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I spawn a thread using AfxBeginThread which is just an infinite while loop: UINT CMyClass::ThreadProc( LPVOID param ) { while (TRUE) { // do stuff } return 1; } How do I kill off this thread in my class destructor? I think something like UINT CMyClass::ThreadProc( LPVOID param ) { while (m_bKillThread) { // do stuff } return 1; } and then set m_bKillThread to FALSE in the destructor. But I still need to wait in the destructor until the thread is dead.
Tags (comma-separated)
Save Edits
Cancel