File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/main/clojure/clojure/core Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ IOC and vthread code.
8383 [java.util.concurrent ThreadLocalRandom]
8484 [java.util Arrays ArrayList]))
8585
86+ (when (not dispatch/lazy-loading-supported?)
87+ (require 'clojure.core.async.impl.go))
88+
8689(alias 'core 'clojure.core)
8790
8891(set! *warn-on-reflection* false )
@@ -512,8 +515,9 @@ IOC and vthread code.
512515 (when ret @ret)))
513516
514517(defn- dynamic-require [nsym]
515- (dispatch/ensure-clojure-version! 1 12 3 )
516- (require nsym))
518+ (when (and dispatch/lazy-loading-supported?
519+ (not (contains? @@#'clojure.core/*loaded-libs* nsym)))
520+ (#'clojure.core/serialized-require nsym)))
517521
518522(defn- go* [body env]
519523 (cond (and (not dispatch/virtual-threads-available?)
Original file line number Diff line number Diff line change 7373 [workload]
7474 (Executors/newCachedThreadPool (counted-thread-factory (str " async-" (name workload) " -%d" ) true )))
7575
76- (def ensure-clojure-version!
77- (memoize
78- (fn [maj min incr]
79- (let [{:keys [major minor incremental]} *clojure-version*]
80- (when (neg? (compare [major minor incremental] [maj min incr]))
81- (throw (ex-info (str " core.async go block expander requires Clojure version ≥"
82- maj " ." min " ." incr
83- " to load" )
84- {:clojure-version *clojure-version*})))))))
76+ (defn at-least-clojure-version?
77+ [[maj min incr]]
78+ (let [{:keys [major minor incremental]} *clojure-version*]
79+ (not (neg? (compare [major minor incremental] [maj min incr])))))
80+
81+ (def lazy-loading-supported? (at-least-clojure-version? [1 12 3 ]))
8582
8683(def virtual-threads-available?
8784 (try
You can’t perform that action at this time.
0 commit comments