File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/main/clojure/clojure/core/async/impl Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 7171 [workflow]
7272 (Executors/newCachedThreadPool (counted-thread-factory (str " async-" (name workflow) " -%d" ) true )))
7373
74+ (def virtual-threads-available?
75+ (try
76+ (Class/forName " java.lang.Thread$Builder$OfVirtual" )
77+ true
78+ (catch ClassNotFoundException _
79+ false )))
80+
81+ (defn- make-io-executor
82+ []
83+ (if virtual-threads-available?
84+ (-> (Thread/ofVirtual )
85+ (Thread$Builder/.name " async-vthread-io-" 0 )
86+ .factory
87+ Executors/newThreadPerTaskExecutor)
88+ (make-ctp-named :io )))
89+
7490(defn ^:private create-default-executor
7591 [workload]
7692 (case workload
7793 :compute (make-ctp-named :compute )
78- :io (make-ctp-named :io )
94+ :io (make-io-executor )
7995 :mixed (make-ctp-named :mixed )))
8096
8197(def executor-for
You can’t perform that action at this time.
0 commit comments