Home > Back-end >  Qt mutex problem
Qt mutex problem

Time:04-14

I understand the mutex is, thread object to m_mutex. The lock (); , because the mutex is not the same, the code can perform, rather than wait for the release;
But the result of the execution is locked, wait for the lock, is there any leaders explain, the mutex is how to return a responsibility?

 void WorkThread: : run () 
{

While (count<100) {
//QMutexLocker locker (& amp; M_mutex);//
M_mutex. The lock ();//m_mutex are members of the thread class,
count++;
QDebug () & lt; <& M_mutex & lt; M_mutex. Unlock ();
}
}
  • Related