[Openmcl-devel] Is setf atomic?

Pascal Costanza pc at p-cos.net
Tue Nov 6 15:12:42 PST 2007


OK, I'll rephrase my question:

Assume there is one thread executing the following endless loop on a  
shared global variable:

(defvar *shared-var* 42)

...
    (loop (setf *shared-var* 84)
          (setf *shared-var* 42))
...

Further assume that this is the only thread that ever assigns to  
*shared-var* - all other threads either don't touch it, or only read  
from it.

Will the only values ever read from this variable be 42 and 84, or is  
it possible that sometimes some threads read something else (that is,  
garbage) from that variable?

To generalize, are there datatypes other than integers for which it  
could be that other threads read garbage from such a variable?

Thanks for your patience.


Pascal

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium







More information about the Openmcl-devel mailing list