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 condition variable because one of the threads will wait on content to be stored into the queue by the other thread.
For use case A I see code example using std::lock_guard<>
. For use case B I see code example using std::unique_lock<>
.
What is the difference between the two and which one should I use in which use case?