Home > Back-end >  Class destructor thread member resources release order problems
Class destructor thread member resources release order problems

Time:09-24

In the MFC, the specific example: for example, I now have a class, in a member function to open a thread, thread written
While (m_thread_flag)
{
If (m_prama_ok)
{... }
}

In the class destructor m_thread_flag set to false, sometimes m_prama_ok has been destruction caused by collapse, also is the class have already begun the destructor, but the thread is running, in the calling class private variables also cause errors, could you tell me how to deal with this problem, I need to open a thread, need to use class variables)?

CodePudding user response:

The WaitForSingleObject or WaitForMultipleObjects

After the thread is to destroy the object

CodePudding user response:

"Windows core programming"
  • Related