anchor.diff:       with lock = (event-queue-lock queue)
        with cv = (event-queue-processes queue)
        with timeout-time = (and timeout (+ timeout (now)))
  +     with event = nil
        do
          (check-schedule queue)
          (with-lock-held (lock)
  -         (if-let ((event (%event-queue-read queue)))
  -           (return event)
  -           (cond ((maybe-funcall wait-function)
  -                  (return (values nil :wait-function)))
  -                 ((and timeout-time (> (now) timeout-time))
  -                  (return (values nil :timeout)))
  -                 (t
  -                  (let* ((schedule-time (event-schedule-time queue))
  -                         (decay (compute-decay timeout-time schedule-time)))
  -                    (condition-wait cv lock decay))))))))
  +         (cond ((maybe-funcall wait-function)
  +                (return (values nil :wait-function)))
  +               ((setf event (%event-queue-read queue))
  +                (return event))
  +               ((and timeout-time (> (now) timeout-time))
  +                (return (values nil :timeout))))
  +         (let* ((schedule-time (event-schedule-time queue))
  +                (decay (compute-decay timeout-time schedule-time)))
  +           (condition-wait cv lock decay)))))
   
   (defmethod event-queue-append ((queue concurrent-event-queue) item)
     (with-lock-held ((event-queue-lock queue))
  
positive.code: 
  (defmethod event-queue-read-with-timeout ((queue simple-event-queue) timeout wait-function)
    (do-port-force-output queue)
    ;; Preemptive check (timeout may be past due). -- jd 2018-12-30
    (check-schedule queue)
    (process-next-event (event-queue-port queue) :timeout 0)
    (loop
       with port = (event-queue-port queue)
       with timeout-time = (and timeout (+ timeout (now)))
       do
         (cond ((event-queue-head queue)
                (return (%event-queue-read queue)))
               ((and timeout-time (> (now) timeout-time))
                (return (values nil :timeout)))
               ((multiple-value-bind (available reason)
                    (let* ((schedule-time (event-schedule-time queue))
                           (decay (compute-decay timeout-time schedule-time)))
                      (process-next-event port
                                          :timeout decay
                                          :wait-function wait-function))
                  (and (null available) (eql reason :wait-function)))
                (return (values nil :wait-function)))
               (t (check-schedule queue)))))
  
  (defmethod event-queue-append ((queue simple-event-queue) item)
    (labels ((append-event ()
  
negative.code:                                        &key timeout wait-function)
    (do-port-force-output queue)
    (check-schedule queue)
    (let ((port (event-queue-port queue)))
     (multiple-value-bind (available reason)
         (process-next-event port :timeout 0
                                  :wait-function wait-function)
       (declare (ignore available))
       (cond ((eq reason :wait-function)
              (return-from event-queue-listen-or-wait
                (values nil :wait-function)))
             ((event-queue-head queue)
              (return-from event-queue-listen-or-wait
                t))))
      (loop
        with timeout-time = (and timeout (+ timeout (now)))
        do (cond ((maybe-funcall wait-function)
                  (return (values nil :wait-function)))
                 ((event-queue-head queue)
                  (return t))
                 ((and timeout-time (> (now) timeout-time))
                  (return (values nil :timeout)))
                 ((multiple-value-bind (available reason)
                      (let* ((schedule-time (event-schedule-time queue))
                             (decay (compute-decay timeout-time schedule-time)))
                        (process-next-event port
                                            :timeout decay
                                            :wait-function wait-function))
                    (when (null available)
                      (return (values nil reason)))))
                 (t (check-schedule queue))))))
  
  (defmethod event-queue-listen ((queue simple-event-queue))
    (event-queue-listen-or-wait queue :timeout 0))
  