anchor.diff:       with lock = (event-queue-lock queue)
        with cv = (event-queue-processes queue)
        with timeout-time = (and timeout (+ timeout (now)))
  -     as decay = (compute-decay timeout-time (event-schedule-time queue))
        do
  -     ;; We CLAMPF decay when wait-function is present to ensure that
  -     ;; we don't get stuck until next event arrives (or the timeout
  -     ;; happens). It is busy wait with a lousy grain. -- jd 2019-06-06
  -       (when decay (if wait-function
  -                       (clampf decay 0 0.01)
  -                       (maxf decay 0)))
  -       (with-recursive-lock-held (lock)
  -         (check-schedule queue)
  +       (check-schedule queue)
  +       (with-lock-held (lock)
            (cond ((event-queue-head queue)
                   (return t))
                  ((maybe-funcall wait-function)
                   (return (values nil :wait-function)))
                  ((and timeout-time (> (now) timeout-time))
                   (return (values nil :timeout)))
  -               (T
  -                (condition-wait cv lock decay))))))
  +               (wait-function
  +                ;; We CLAMP decay when wait-function is present to
  +                ;; ensure that we don't get stuck until next event
  +                ;; arrives (or the timeout happens). It is busy wait
  +                ;; with a lousy grain. -- jd 2019-06-06
  +                (if-let ((decay (compute-decay timeout-time
  +                                               (event-schedule-time queue))))
  +                  (condition-wait cv lock (min 0.01 decay))
  +                  (condition-wait cv lock 0.01)))
  +               (t
  +                (let ((decay (compute-decay timeout-time
  +                                            (event-schedule-time queue))))
  +                  (condition-wait cv lock decay)))))))
   
    
  
positive.code: (declaim (inline now compute-decay))
  (defun now ()
    (/ (get-internal-real-time)
       1.0
       internal-time-units-per-second))
  
  ;; Given two alarm times compute remaining time (in seconds). If both times are
  ;; NIL returns NIL.
  (defun compute-decay (time-1 time-2)
    (cond ((and time-1 time-2) (- (min time-1 time-2) (now)))
          (time-1 (- time-1 (now)))
          (time-2 (- time-2 (now)))
          (T NIL)))
  
  ;; See if it's time to inject a scheduled event into the queue.
  (defgeneric check-schedule (queue)
  
negative.code:      with lock = (event-queue-lock queue)
       with cv = (event-queue-processes queue)
       with timeout-time = (and timeout (+ timeout (now)))
       do
         (check-schedule queue)
         (with-lock-held (lock)
           (if-let ((event (%event-queue-read queue)))
             (return event)
             (cond ((maybe-funcall wait-function)
  