




15.4 Low level atomic operations
Low level atomic operations are defined in all cases for a specific set of places. These places are listed in Places for which low-level atomic operations are defined:
Places for which low-level atomic operations are defined
Place
|
Notes
|
(
symbol-value
symbol
)
|
When
symbol
is dynamically bound, this means the dynamically bound value.
|
(
car
cons
)
|
|
(
cdr
cons
)
|
|
(
svref
sv
index
)
|
Only
simple-vector
.
|
Structure accessors
|
The structure must be defined at compile time, and normally there are only macros for atomic operations on structures.
|
(
slot-value
object
slot-name
)
|
See below.
|
Notes about atomic
slot-value
operations:
-
They ignore the MOP slot-value-using-class protocol and can only be used for
:instance
and
:class
allocated slots.
-
They are slower than the atomic operations on other types of object because they have to lock the instance. It may be better to have a slot pointing to some other object (for example a structure) and do the atomic operations on that object.
The low level atomic operations implicitly ensure order of memory between operations in different threads.
The low level atomic operations are: atomic-push, atomic-pop, atomic-fixnum-incf, atomic-fixnum-decf, atomic-incf, atomic-decf, atomic-exchange, compare-and-swap, define-atomic-modify-macro and setup-atomic-funcall.
You can test whether a place is suitable for use with these operations by the predicate low-level-atomic-place-p.
LispWorks User Guide and Reference Manual - 22 Dec 2009




