compare-and-swap doesn't work on special variables
compare-and-swap is very useful for swapping value of a dynamic binding if it matches the certain value (i.e "current thread", or "this display"). This doesn't work on ECL.
> (defvar *xxx* 3)
> (mp:compare-and-swap *xxx* 4 8)
;; error, expected would be leaving *xxx* unchanged
> (mp:compare-and-swap *xxx* 3 4)
;; error, expected would be setting *xxx* to 4
> *xxx*
;; 3, expected would be 4
> (setf *xxx* 4*)
> (let ((*xxx* 5)) (compare-and-swap *xxx* 5 8) *xxx*)
;; error, expected would be 8
> *xxx*
;; 4 (compare-and-swap on dynamic binding doesn't change the symbol-value)
Tested version: ECL from develop branch (6bb08c2d). NB: this prevents us from using compare-and-swap on clx (which may benefit from it).