Synchronization Forms
Simple critical region helpers.
Invoke PROCEDURE on the argument list ARGUMENT ... while MUTEX locked.
Invoke PROCEDURE on the (mutex-specific MUTEX)
and the ARGUMENT ... while MUTEX locked.
Apply PROCEDURE to the argument list ARGUMENT ... while MUTEX locked.
Apply PROCEDURE to the (mutex-specific MUTEX)
and the ARGUMENT ... while MUTEX locked.
Execute BODY ... while MUTEX locked.
Execute BODY ... while MUTEX locked and the mutex-specific bound to VARIABLE.
Execute BODY ... while MUTEX locked, and leave mutex locked.
Execute BODY ... while MUTEX locked, and leave mutex unlocked.
Expands into a nested (synch-with BINDVAL BINDVAR ...)
form, a synch-with
for each binding pair in BINDINGS. The leftmost binding pair is the outermost.
While the mutex of the BINDING is locked, evaluates BODY with the variable of the BINDING bound to the mutex-specific. Sets the mutex-specific of the mutex to the result of the evaluation. Returns the new value.
Execute BODY ... while MUTEX locked.
The top-level forms of BODY ... are parsed for occurrences of ><
. All such occurrences are replaced by the mutex-specific value.
Execute BODY ... while the RECORD-OBJECT mutex is locked. The mutex is a field of the record named {RECORD-SYMBOL}-mutex.
Execute BODY ... while the RECORD-OBJECT mutex is locked, and leave the mutex locked.
Execute BODY ... while the RECORD-OBJECT mutex is locked, and leave the mutex unlocked.
These forms do not have the mutex lock/unlock wrapped in dynamic-wind
, otherwise the same behavior.
Synonym for mutex-specific-set!
.
Name is confusing since it implies synchronization.
Returns a mutex with a mutex-specific value of OBJECT, and optional mutex NAME.
NAME is either a symbol or a one element list of symbol. When a list the first element is used as the basis for a generated symbol. When a symbol it is used literally as the mutex name.
When NAME is missing a generated symbol with the prefix synchobj
is provided.
Is the OBJECT a synchronized object - a mutex with a non-void mutex specific?
The optional PREDICATE is used to verify the type of the mutex specific binding. Otherwise any object is accepted.
Inspired by Thomas Chust.
Copyright (c) 2006, Kon Lovett. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.