Commits

Moritz Heidkamp  committed e77dc35

rename `queue-consume-calling!` to `run-callback-queue!`

  • Participants
  • Parent commits 066ab34

Comments (0)

Files changed (1)

 (define (call-each arg procs)
   (for-each (lambda (proc) (proc arg)) procs))
 
-(define (queue-consume-calling! queue . args)
+(define (run-callback-queue! queue . args)
   (let loop ()
     (unless (queue-empty? queue)
       (apply (queue-remove! queue) args)
                         (and (null? receivers) (queue-empty? onetime-receivers)))
               (let ((message (queue-remove! queue)))
                 (unless (queue-empty? onetime-receivers)
-                  (queue-consume-calling! onetime-receivers message)
+                  (run-callback-queue! onetime-receivers message)
                   (condition-variable-broadcast! (channel-cvar channel)))
                 (call-each message receivers))
               (loop)))
           (when (channel-drained? channel)
-            (queue-consume-calling! (channel-on-drain-handlers channel))))
+            (run-callback-queue! (channel-on-drain-handlers channel))))
         (lambda ()
           (mutex-unlock! mutex)))))
 
          (set! (channel-forks channel)
                (filter (lambda (fork)
                          (and-let* ((fork (locative->object fork)))
-                           (apply channel-enqueue! fork messages)))
+                           (unless (null? messages)
+                             (apply channel-enqueue! fork messages))))
                        (channel-forks channel)))
          (mutex-unlock! mutex)
          (channel-flush! channel)
 
 (define (channel-close! channel)
   (set! (channel-closed? channel) #t)
-  (queue-consume-calling! (channel-on-close-handlers channel)))
+  (run-callback-queue! (channel-on-close-handlers channel)))
 
 (define (channel-empty? channel)
   (queue-empty? (channel-queue channel)))