Skip to content

Commit 8e23d93

Browse files
committed
delay on the vthreads available var
1 parent 821a671 commit 8e23d93

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@
6262
(Executors/newCachedThreadPool (counted-thread-factory (str "async-" (name workload) "-%d") true)))
6363

6464
(def virtual-threads-available?
65-
(try
66-
(Class/forName "java.lang.Thread$Builder$OfVirtual")
67-
true
68-
(catch ClassNotFoundException _
69-
false)))
65+
(delay
66+
(try
67+
(Class/forName "java.lang.Thread$Builder$OfVirtual")
68+
true
69+
(catch ClassNotFoundException _
70+
false))))
7071

7172
(def aot-compiling? clojure.core/*compile-files*)
7273

@@ -81,7 +82,7 @@
8182
(defn runtime-vthreads? []
8283
(and (not aot-compiling?)
8384
(not (vthreads-directive-of "avoid"))
84-
virtual-threads-available?))
85+
@virtual-threads-available?))
8586

8687
(defn- make-io-executor
8788
[]

0 commit comments

Comments
 (0)