When one thread using a resource prevents another thread from safely using it, that resource is mutually exclusive. This is typically implemented as a binary semaphore.
To use a mutex a thread must:
- Call semaphore wait
- Do the thing
- Release the semaphore
Only the thread that acquired the mutex can release it. This enforces mutual exclusions.
Warning1
These are traffic lights not Barriers. These are agreed upon signals but do not prevent actual access.