Conditional Variable vs Semaphore
Locks are used for mutual exclusion. When you want to ensure that a piece of code is atomic, put a lock around it. You could theoretically use a binary semaphore to do this, but that’s a special case. Semaphores and condition variables build on top of the mutual exclusion provide by locks and are used … Read more