Next: , Up: Scheduling

5.17.1 Arbiters

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.

— Scheme Procedure: make-arbiter name
— C Function: scm_make_arbiter (name)

Return an object of type arbiter and name name. Its state is initially unlocked. Arbiters are a way to achieve process synchronization.

— Scheme Procedure: try-arbiter arb
— C Function: scm_try_arbiter (arb)
— C Function: scm_try_arbiter (arb)

If arb is unlocked, then lock it and return #t. If arb is already locked, then do nothing and return #f.

— Scheme Procedure: release-arbiter arb
— C Function: scm_release_arbiter (arb)

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.