File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
src/main/clojure/clojure/core/async/impl Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 73
73
[workload]
74
74
(Executors/newCachedThreadPool (counted-thread-factory (str " async-" (name workload) " -%d" ) true )))
75
75
76
- (defn ensure-clojure-version! [maj min incr]
77
- (let [{:keys [major minor incremental]} *clojure-version*]
78
- (when (neg? (compare [major minor incremental] [maj min incr]))
79
- (throw (ex-info (str " core.async go block expander requires Clojure version ≥"
80
- maj " ." min " ." incr
81
- " to load" )
82
- {:clojure-version *clojure-version*})))))
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*})))))))
83
85
84
86
(def virtual-threads-available?
85
87
(try
105
107
106
108
(def ^:private virtual-thread?
107
109
(if virtual-threads-available?
108
- (let [meth (.getMethod (Class/forName " java.lang.Thread" ) " isVirtual" (into-array Class []))
109
- vargs (object-array 0 )]
110
- (fn [thread]
111
- (.invoke meth thread vargs)))
110
+ (eval `(fn [^Thread t#] (~'.isVirtual t#)))
112
111
(constantly false )))
113
112
114
113
(defn in-vthread? []
You can’t perform that action at this time.
0 commit comments