anchor.diff:      ;; TODO: Track how many spin mutexes are currently taken and assert when
       ;; count != 1.
       (:spin (assert (mutex-%lock mutex))))
  -  (let ((self (current-thread)))
  +  (let ((self (current-thread))
  +        (prior-istate (mutex-%lock mutex)))
       (with-footholds-inhibited
  -        (sys.int::%cli)
  +      (sys.int::%cli)
         (lock-wait-queue condition-variable)
         (%lock-thread self)
         ;; Attach to the list.
         (push-wait-queue self condition-variable)
         ;; Drop the mutex.
  -      (release-mutex lock)
  +      ;; Make sure spin mutexes don't reenable interrupts.
  +      (when (eql (mutex-kind mutex) :spin)
  +        (setf (mutex-%lock mutex) nil))
  +      (release-mutex mutex)
         ;; Sleep.
         ;; todo: reenable footholds when the thread is sleeping, but only one level.
         ;; need to be careful with that, returning or unwinding from condition-wait
  
positive.code: ;; The idle thread is not a true thread. It does not appear in all-threads, nor in any run-queue.
  ;; When the machine boots, one idle thread is created for each core. When a core is idle, the
  ;; idle thread will be run.
  (defun idle-thread ()
    (without-interrupts
      (loop
         (sys.int::%stihlt)
         (sys.int::%cli))))
  
  (defun initialize-threads ()
    (when (not (boundp '*global-thread-lock*))
  
negative.code:       (unlock-wait-queue condition-variable)
        (%reschedule)
        ;; Got woken up. Reacquire the mutex.
        (acquire-mutex mutex t)
        ;; And restore :spin istate.
        (when (eql (mutex-kind mutex) :spin)
          (setf (mutex-%lock mutex) prior-istate))))
    (values))
  
  (defun condition-notify (condition-variable &optional broadcast)
  