Next: Asyncs, Up: Scheduling
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
#t
. If arb is already locked, then do nothing and return#f
.
If arb is locked, then unlock it and return
#t
. If arb is already unlocked, then do nothing and return#f
.Typical usage is for the thread which locked an arbiter to later release it, but that's not required, any thread can release it.