anchor.diff:  
   (defstruct (mutex
                (:include wait-queue)
  -             (:constructor make-mutex (&optional name))
  +             (:constructor make-mutex (&optional name (kind :block)))
                (:area :wired))
     ;; When NIL, the lock is free, otherwise is set to
     ;; the thread that holds the lock.
  -  (owner nil))
  -
  -(defun acquire-mutex (mutex wait-p)
  +  (owner nil) ; must be slot 5, after wait-queue is included.
  +  (kind nil :type (member :block :spin) :read-only t))
  +
  +(defun acquire-mutex (mutex &optional (wait-p t))
  +  (ecase (mutex-kind mutex)
  +    (:block (acquire-block-mutex mutex wait-p))
  +    (:spin (acquire-spin-mutex mutex wait-p))))
  +
  +(defun acquire-block-mutex (mutex wait-p)
     (let ((self (current-thread)))
       (assert (sys.int::%interrupt-state))
       (assert (not (thread-footholds-enabled-p self)))
       ;; Fast path - try to lock.
  -    (when (sys.int::%cas-struct-slot mutex 4 nil self)
  +    (when (sys.int::%cas-struct-slot mutex 5 nil self)
         ;; We got it.
  -      (return-from acquire-mutex t))
  +      (return-from acquire-block-mutex t))
       ;; Idiot check.
       (assert (not (mutex-held-p mutex)) (mutex)
               "Recursive locking detected.")
  
positive.code:         (when got-it
            (release-mutex mutex))))))
  
  (defmacro with-mutex ((mutex &optional (wait-p t)) &body body)
    ;; Cold generator has some odd problems with uninterned symbols...
    `(flet ((call-with-mutex-thunk () ,@body))
  
negative.code:       (%reschedule)
        t)))
  
  (defun acquire-spin-mutex (mutex wait-p)
    (let ((self (current-thread))
          (istate (sys.int::%interrupt-state)))
      (sys.int::%cli)
      ;; Fast path - try to lock.
      (when (sys.int::%cas-struct-slot mutex 5 nil self)
        ;; We got it.
        (setf (mutex-%lock mutex) istate)
        (return-from acquire-spin-mutex t))
      ;; Idiot check.
      (assert (not (mutex-held-p mutex)) (mutex)
              "Recursive locking detected.")
      (cond (wait-p
             ;; Spin path.
             (do ()
                 ((sys.int::%cas-struct-slot mutex 5 nil self))
               (sys.int::cpu-relax))
             (setf (mutex-%lock mutex) istate)
             t)
            (t ;; Trylock path.
             (when istate
               (sys.int::%sti))))))
  
  (defun mutex-held-p (mutex)
    "Return true if this thread holds MUTEX."
    (eql (mutex-owner mutex) (current-thread)))
  
  (defun release-mutex (mutex)
    (assert (mutex-held-p mutex))
    (ecase (mutex-kind mutex)
      (:block (release-block-mutex mutex))
      (:spin (release-spin-mutex mutex)))
    (values))
  
  (defun release-block-mutex (mutex)
    (with-wait-queue-lock (mutex)
      ;; Look for a thread to wake.
      (let ((thread (pop-wait-queue mutex)))
  