Skip to content

Commit bd2ba1d

Browse files
committed
Removed use of thread in require to reset dynamic bindings.
1 parent 201df12 commit bd2ba1d

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

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

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -511,36 +511,9 @@ IOC and vthread code.
511511
(let [ret (impl/take! port (fn-handler nop false))]
512512
(when ret @ret)))
513513

514-
(defn- require-in-new-binding-context
515-
"Like require but takes only a single namespace symbol and attempts to
516-
require the namespace on a separate thread. This is done to start
517-
with a fresh dynamic environment augmented only with the vars
518-
needed by require to perform its job. If the namespace is
519-
found to have already been loaded then this function will return
520-
immediately."
521-
[nsym]
522-
(when (not (contains? @@#'clojure.core/*loaded-libs* nsym))
523-
(let [p (promise)
524-
n *ns*
525-
ll @#'clojure.core/*loaded-libs*]
526-
(dispatch/exec
527-
(^:once fn* []
528-
(try
529-
(let [result (binding [*ns* n
530-
clojure.core/*loaded-libs* ll]
531-
(#'clojure.core/serialized-require nsym))]
532-
(deliver p result))
533-
(catch Throwable t
534-
(deliver p t))))
535-
:io)
536-
(let [res @p]
537-
(if res
538-
(throw res)
539-
res)))))
540-
541514
(defn- go* [body env]
542515
(cond (not dispatch/target-vthreads?)
543-
(do (require-in-new-binding-context 'clojure.core.async.impl.go)
516+
(do (require 'clojure.core.async.impl.go)
544517
((find-var 'clojure.core.async.impl.go/go-impl) env body))
545518

546519
(or dispatch/vthreads-available-and-allowed? clojure.core/*compile-files*)

0 commit comments

Comments
 (0)