Commits

Moritz Heidkamp  committed 8243917

slightly cheaper implementation of the default default value of channel-receive

  • Participants
  • Parent commits 73b033d

Comments (0)

Files changed (1)

          (timeout (and (pair? args)
                        (let ((t (car args)))
                          (and (number? t) t))))
-         (default (and timeout (if (pair? (cdr args))
-                                   (cadr args)
-                                   (lambda () #f))))
+         (default (and timeout 
+                       (pair? (cdr args))
+                       (cadr args)))
          (sync?   (or timeout (null? args))))
 
     (when (have-lock? mutex)
               (queue-add! rqueue (lambda (x) (set! message x)))
               (if (mutex-unlock! mutex cvar timeout)
                   message
-                  (default)))
+                  (and default (default))))
             (let ((message (queue-remove! queue)))
               (mutex-unlock! mutex)
               message))