Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Demonstrates behavior of mult bug
(deftest ops-test
(testing "mult with closed tap"
(go
(let [a (chan 4)
b (chan 4)
src (chan 1)
m (async/mult src)]
(async/tap m a)
(async/tap m b)
(async/close! a)
(async/pipe (async/to-chan (range 4)) src)
(.log js/console "a=" (clj->js (<! (async/into [] a))))
(.log js/console "b=" (clj->js (<! (async/into [] b))))))))
@loganlinn
Owner

Patch:

From c579a18538ddc0570628e88735099090331bbe51 Mon Sep 17 00:00:00 2001
From: loganlinn <logan.linn@gmail.com>
Date: Thu, 15 May 2014 09:42:30 -0700
Subject: [PATCH] Remove extra decrement

---
 src/main/clojure/cljs/core/async.cljs | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/clojure/cljs/core/async.cljs b/src/main/clojure/cljs/core/async.cljs
index e94a2db..542c90b 100644
--- a/src/main/clojure/cljs/core/async.cljs
+++ b/src/main/clojure/cljs/core/async.cljs
@@ -454,7 +454,6 @@
            (reset! dctr (count chs))
            (doseq [c chs]
                (when-not (put! c val done)
-                 (swap! dctr dec)
                  (untap* m c)))
            ;;wait for all
            (when (seq chs)
-- 
1.9.2

Before patch:

a= []

After patch:

a= []
b= [ 0, 1, 2, 3 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.