Does a mutex get unlocked when calling notify on a condition variable?

The lock is being acquired in the constructor and released in the destructor of std::unique_lock. From this info you can deduce that the producer releases the lock after the call to notify_one() completes.


Notifying does not unlock the mutex. You can tell (indirectly) because you don't pass the lock to notify_one() the way you do to wait(), which does release the mutex while it waits.

On the other side, the notified thread(s) are notified "immediately". But they won't necessarily return from wait() immediately. Before they can return from wait() they must first re-acquire the mutex, so they will block there until the notifying thread releases it.