[Openmcl-devel] Is setf atomic?
David L. Rager
ragerdl at cs.utexas.edu
Tue Apr 21 14:32:33 EDT 2009
We all knew this thread would reawaken someday.
Is application of a rplacd atomic (as opposed to the evaluation of a
replacd's arguments, which are of course non-atomic)? That is, if I
replace the cdr of a cons, can I be guaranteed that a separate thread
reading that cons pair will always see the old cdr or the new cdr and
not some weird hybrid?
FWIW, I'm on a 64 bit machine.
> If thread A did (setf *var* 42) and thread B did (setf *var* 43)
> at "about the same time", then the value of *var* after both
> threads complete will be either 42 or 43, depending on the
> whims of the scheduler. (It will be one or the other, not the
> old value or some hybrid value.)
> The only exception to this that I can think of involves storing
> 64-bit integer values in foreign memory locations on 32-bit
> hardware; that's done as two "store 32-bit word" operations,
> and an observer could see that the first word had been stored
> and the second one hadn't if it looked carefully/quickly enough.
More information about the Openmcl-devel