Arbiters are synchronization objects, they can be used by threads to control access to a shared resource. An arbiter can be locked to indicate a resource is in use, and unlocked when done.
An arbiter is like a light-weight mutex (see Mutexes and Condition Variables). It uses less memory and may be faster, but there’s no way for a thread to block waiting on an arbiter, it can only test and get the status returned.
Return an object of type arbiter and name name. Its state is initially unlocked. Arbiters are a way to achieve process synchronization.
If arb is unlocked, then lock it and return
If arb is already locked, then do nothing and return
If arb is locked, then unlock it and return
arb is already unlocked, then do nothing and return
Typical usage is for the thread which locked an arbiter to later release it, but that’s not required, any thread can release it.