anchor.diff:               (with-pop-success task queue
                  (return-from next-task task))
                (values))
  -           (find-a-task ()
  -             (try-pop (tasks worker))
  +           (try-pop-all ()
                (with-scheduler-slots (workers) scheduler
                  (do-workers (worker workers (worker-index worker) nil)
                    (try-pop (tasks worker))))
  
positive.code:      task (tasks (svref workers (mod-decf random-index (length workers))))))
    #-ecl (values) #+ecl nil)
  
  (defun/type maybe-wake-a-worker (scheduler) (scheduler) t
    (declare #.*full-optimize*)
    (with-scheduler-slots (wait-lock wait-cvar wait-count notify-count) scheduler
      (with-lock-predicate/wait wait-lock (plusp (counter-value wait-count))
        (incf notify-count)
        (condition-notify wait-cvar))))
  
  (defun/type schedule-task (scheduler task priority) (scheduler
                                                       (or task null) t) t
    (declare #.*full-optimize*)
    (ccase priority
      (:low     (with-scheduler-slots (low-priority-tasks) scheduler
                  (push-spin-queue task low-priority-tasks)))
      (:default (push-to-random-worker task scheduler)))
    (maybe-wake-a-worker scheduler))
  
  (defmacro do-workers ((worker-var workers start-index from-start-p)
                        &body body)
    (with-gensyms (worker-index)
      `(do-indexes (,worker-index
                    (length (the simple-vector ,workers))
                    ,start-index
                    ,from-start-p)
         (let ((,worker-var (svref (the simple-vector ,workers) ,worker-index)))
           (declare (type worker ,worker-var))
           ,@body))))
  
  (defun/type next-task (scheduler worker) (scheduler worker) (or task null)
    (declare #.*full-optimize*)
  
negative.code:        (declare (type fixnum ,left))
         (loop
            (when (zerop ,left)
              (return (values)))
            (decf ,left)
            ,@body))))
  
  (defmacro do-indexes ((index-var size home-index from-home-index-p) &body body)
    ;; size is positive
    (with-gensyms (size-var home-index-var)
      `(let ((,index-var (the index ,home-index))
             (,size-var (the index ,size))
             (,home-index-var (the index ,home-index)))
         (declare (type index ,index-var ,size-var ,home-index-var))
         (loop
            ,(let ((next `(mod-incf ,index-var ,size-var)))
               (if from-home-index-p
                   `(progn ,@body ,next)
                   `(progn ,next ,@body)))
            (when (= ,index-var ,home-index-var)
              (return (values)))))))
  
  ;;;; scheduler
  
  