All Manuals > LispWorks User Guide and Reference Manual > 15 Multiprocessing

NextPrevUpTopContentsIndex

15.10 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 low-level atomic operations:

Places for low-level atomic operations

Place

Notes

( symbol-value symbol )

When symbol is dynamically bound, this means the dynamically bound value.

A dynamically bound symbol

The dynamically bound value.

A lexically bound symbol

It is an error to use a low level atomic operation on a lexically bound symbol.

( car cons )

 

( cdr cons )

 

( the type place )

For another place listed in this table.

( svref sv index )

Only simple-vector .

Structure accessors

The structure must be defined at compile time.

( slot-value object slot-name )

See below.

Notes about atomic slot-value operations:

  1. They ignore the MOP slot-value-using-class protocol and can only be used for :instance and :class allocated slots.
  2. They are slower than the atomic operations on other types of object because they have to lock the instance. Normally it would 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 and compare-and-swap.

Application of macros that are defined by define-atomic-modify-macro is also restricted to the places in Places for low-level atomic operations above, because they implicitly use low level atomic operations.

You can test whether a place is suitable for use with these operations by the predicate low-level-atomic-place-p.

15.10.1 Aids for implementing modification checks

15.10.2 Ensuring order of memory between operations in different threads


LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex