Skip to content

Commit 07de58f

Browse files
committed
rely on chan datafy and alts nil check in main lib
1 parent 11a55c0 commit 07de58f

File tree

1 file changed

+2
-13
lines changed
  • src/main/clojure/clojure/core/async/flow

1 file changed

+2
-13
lines changed

src/main/clojure/clojure/core/async/flow/impl.clj

+2-13
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@
2626
(defn oid [x]
2727
(symbol (str (-> x class .getSimpleName) "@" (-> x System/identityHashCode Integer/toHexString))))
2828

29-
(defn chan->data
30-
[^clojure.core.async.impl.channels.ManyToManyChannel c]
31-
(let [b (.buf c)]
32-
{:buffer (if (some? b) (oid b) :none)
33-
:buffer-count (count b)
34-
:put-count (count (.puts c))
35-
:take-count (count (.takes c))
36-
:closed? (clojure.core.async.impl.protocols/closed? c)}))
37-
3829
(defn exec->data [exec]
3930
(let [ess (as-> (str exec) ^String es
4031
(.substring es (inc (.lastIndexOf es "[")) (.lastIndexOf es "]"))
@@ -49,7 +40,6 @@
4940
clojure.lang.Fn (-> x str symbol)
5041
ExecutorService (exec->data x)
5142
clojure.lang.Var (symbol x)
52-
clojure.core.async.impl.channels.ManyToManyChannel (chan->data x)
5343
(datafy/datafy x)))
5444

5545
(defn futurize ^Future [f {:keys [exec]}]
@@ -242,9 +232,8 @@
242232
(loop [nstatus nstatus, nstate nstate, msgs (seq msgs)]
243233
(if (or (nil? msgs) (= nstatus :exit))
244234
[nstatus nstate]
245-
(let [m (if-some [m (first msgs)] m (throw (Exception. "messages must be non-nil")))
246-
[v c] (async/alts!!
247-
[control [outc m]]
235+
(let [[v c] (async/alts!!
236+
[control [outc (first msgs)]]
248237
:priority true)]
249238
(if (= c control)
250239
(let [nnstatus (handle-command nstatus v)

0 commit comments

Comments
 (0)