(take! port fn1)
(take! port fn1 on-caller?)
Asynchronously takes a val from port, passing to fn1. Will pass nil
if closed. If on-caller? (default true) is true, and value is
immediately available, will call fn1 on calling thread.
Returns nil.
Source
(defn
take!
"Asynchronously takes a val from port, passing to fn1. Will pass nil\n if closed. If on-caller? (default true) is true, and value is\n immediately available, will call fn1 on calling thread.\n Returns nil."
([port fn1] (take! port fn1 true))
([port fn1 on-caller?]
(let
[ret (impl/take! port (fn-handler fn1))]
(when
ret
(let
[val @ret]
(if on-caller? (fn1 val) (dispatch/run (fn* [] (fn1 val))))))
nil)))