Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.async by

Quote from docstring: "(link: ...) each tap must accept before the next item is distributed."

(def ch (chan))

(def m (mult ch))

(def t-1 (chan))
(def t-2 (chan))
(def t-3 (chan))

(def t-1-takes (atom []))

(defn log [l] (partial swap! l conj))

(tap m t-1)
(tap m t-2)
(tap m t-3)

(close! t-3)

(take! t-1 (log t-1-takes))

(take! t-1 (log t-1-takes)) ;; this take shouldn't be happening before

                        ;; a take on t-2

(put! ch true)

(put! ch true)


;-> [true true] ;; but it does.

The reason is that the internal atom dctr is decreased twice when a tapped channel is already closed.

2 Answers

0 votes

Comment made by: lgs32a

Fixing this for clj/cljs

0 votes
Reference: https://clojure.atlassian.net/browse/ASYNC-127 (reported by lgs32a)