MacroPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version

atomic-conditional-setf

Arguments: place newval-form oldval-form

This is the primitive form on which some other atomic operations (update-atomic, incf-atomic, decf-atomic, pop-atomic, and push-atomic) are based. It acts very much like

   (when (eq place oldval-form)
     (setf place newval-form)
     t)

In atomic-conditional-setf, the computation of place subforms, oldvalform, and newval-form are not atomic with respect to anything but the comparison and store (if there is one) are an atomic sequence.

A technical compiler issue limits it to appearing only as the test form in a conditional, as in the following example of an atomic increment equivalent to (incf-atomic (car x)):

   (loop
     (let* ((old (car x))
            (new (1+ old)))
       (when (atomic-conditional-setf (car x) new old)
         (return))))

Not all places legal as the first argument of setf can be used as the place argument to this macro. The list of allowable places can be found in Atomic read-modify-write primitives in smp.htm.

See smp.htm and multiprocessing.htm for more information on this macro and on multiprocessing.


Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version