I have two use cases.
A. I want to synchronise access to a queue for two threads.
B. I want to synchronise access to a queue for two threads and use a conditio
Use lock_guard unless you need to be able to manually unlock the mutex in between without destroying the lock.
lock_guard
unlock
lock
In particular, condition_variable unlocks its mutex when going to sleep upon calls to wait. That is why a lock_guard is not sufficient here.
condition_variable
wait