All Manuals > LispWorks User Guide and Reference Manual > 49 The SYSTEM Package

NextPrevUpTopContentsIndex

compare-and-swap

Macro
Summary

Performs a conditional store, atomically.

Package

system

Signature

compare-and-swap place compare new-value => result

Arguments

place

One of the specific set of places defined for low level atomic operations.

compare

An object.

new-value

An object.

Values

result

A boolean.

Description

The macro compare-and-swap compares the value in place with compare, and if they are the same (by eq), stores the new-value in place.

compare-and-swap returns non-nil if the store occurred, or nil if the store did not occur.

place must be one of the places described in Low level atomic operations, or expand to one of them.

The operation is guaranteed to be atomic.

See also

atomic-exchange
low-level-atomic-place-p


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex