[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
doc arbiters
From: |
Kevin Ryde |
Subject: |
doc arbiters |
Date: |
Mon, 02 Aug 2004 10:18:47 +1000 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
A bit of a tweak to the arbiters node. The old words suggested that
only the thread which locked an arbiter could release it, I propose to
relax that to reflect the way the code works, which is that anyone can
release.
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 (*note Low level thread
primitives::). It uses a little less memory, but there's no means 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 arbiter object, initially unlocked. Currently NAME is
only used for diagnostic output.
-- Scheme Procedure: 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- doc arbiters,
Kevin Ryde <=