Skip to content

Commit

Permalink
ASYNC-252 Move go analyzer from ioc-macros to impl.go namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed Dec 17, 2024
1 parent 5a6a346 commit 57b4fca
Show file tree
Hide file tree
Showing 5 changed files with 1,065 additions and 1,132 deletions.
14 changes: 2 additions & 12 deletions src/main/clojure/clojure/core/async.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ to catch and handle."
[clojure.core.async.impl.timers :as timers]
[clojure.core.async.impl.dispatch :as dispatch]
[clojure.core.async.impl.ioc-macros :as ioc]
clojure.core.async.impl.go ;; TODO: make conditional
[clojure.core.async.impl.mutex :as mutex]
[clojure.core.async.impl.concurrent :as conc]
)
Expand Down Expand Up @@ -456,18 +457,7 @@ to catch and handle."
Returns a channel which will receive the result of the body when
completed"
[& body]
(let [crossing-env (zipmap (keys &env) (repeatedly gensym))]
`(let [c# (chan 1)
captured-bindings# (Var/getThreadBindingFrame)]
(dispatch/run
(^:once fn* []
(let [~@(mapcat (fn [[l sym]] [sym `(^:once fn* [] ~(vary-meta l dissoc :tag))]) crossing-env)
f# ~(ioc/state-machine `(do ~@body) 1 [crossing-env &env] ioc/async-custom-terminators)
state# (-> (f#)
(ioc/aset-all! ioc/USER-START-IDX c#
ioc/BINDINGS-IDX captured-bindings#))]
(ioc/run-state-machine-wrapped state#))))
c#)))
(#'clojure.core.async.impl.go/go-impl &env body))

(defonce ^:private ^Executor thread-macro-executor
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-thread-macro-%d" true)))
Expand Down
Loading

0 comments on commit 57b4fca

Please sign in to comment.