Skip to content

Commit 6da0ec7

Browse files
committed
use reflection to find startVTs
1 parent 1212db4 commit 6da0ec7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@
120120
(defn- make-io-executor
121121
[]
122122
(if vthreads-available-and-allowed?
123-
(reify Executor
124-
(execute [_ r]
125-
(Thread/startVirtualThread r)))
123+
(let [svt (.getDeclaredMethod Thread "startVirtualThread" (into-array Class [Runnable]))]
124+
(reify Executor
125+
(execute [_ r]
126+
(.invoke svt nil (object-array [r])))))
126127
(make-ctp-named :io)))
127128

128129
(defn ^:private create-default-executor

0 commit comments

Comments
 (0)