Semaphores for Ordering
This lesson discusses another use case of semaphores, as a way for ordering events in concurrent programs.
Semaphores are also useful to order events in a concurrent program. For example, a thread may wish to wait for a list to become non-empty, so it can delete an element from it. In this pattern of usage, we often find one thread waiting for something to happen, and another thread making that something happen and then signaling that it has happened, thus waking the waiting thread. We are thus using the semaphore as ...
Get hands-on with 1400+ tech skills courses.