Unsolved Does QWaitCondition::wait locks the mutex again?
-
Accroding to doc
theQWaitCondition::wait
unlocks the mutex, but in the same doc there is exampleforever { mutex.lock(); keyPressed.wait(&mutex); do_something(); mutex.unlock(); }
in the last line the mutex is unlocked again. Why?? Does
QWaitCondition::wait
locks it again? -
Yes, it does. In the docs for QWaitCondition::wait()
The lockedMutex will be returned to the same locked state. This function is provided to allow the atomic transition from the locked state to the wait state.