Special Operator | Package: excl | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## atomic-conditional-setq

Arguments: symbol newval-form oldval-form

This special operator returns a boolean of success or failure to store the value into the symbol's value location. It is intended to be a synchronizing mechanism for symbols which represent variables shared by multiple threads. It is undefined for symbols which represent a purely local (i.e. non-shared) value. Currently, the interpreted form of atomic-conditional-setq accepts such local variables, but the compiler will signal an error if the variable is not special or closed-over.

### Arguments

- symbol may name either a special or a closed-over variable. If the symbol names a symbol-macro or is currently shadowed by a symbol-macrolet, then the excl:atomic-conditional-setf is used to handle the macroexpansion (which might then eventually get back to atomic-conditional-setq if the place value is symbolic after full macroexpansion).

  Note that the compilation of atomic-conditional-setq does not error if the symbol names a special variable and that special is currently let/lambda bound in the current thread even though such a value is thread-local. Also, the compilation of atomic-conditional-setq does not error if the variable is closed over but can't possibly be seen by another thread.

- newval-form is any form which will be evaluated and the result used as a new value to store into the symbol.
- oldval-form is evaluated to a value, presumably taken from the symbol's value at an earlier time.

In an atomic operation, if the variable's current value is EQ to the old value then the new value is stored into the variable location and the special operator returns True. Otherwise, the new value is not stored, and the special-operator returns false. Note that none of the evaluations of the symbol as a variable, or of the newval-form, or of the oldval-form, are atomic; the only operations that are atomic are the comparison and store, if there is one.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version