Important: Please read the Qt Code of Conduct -

Does QWaitCondition::wait locks the mutex again?

  • Accroding to doc
    the QWaitCondition::wait unlocks the mutex, but in the same doc there is example

    forever {

    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.

Log in to reply