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 71
71
[workflow]
72
72
(Executors/newCachedThreadPool (counted-thread-factory (str " async-" (name workflow) " -%d" ) true )))
73
73
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
+
74
90
(defn ^:private create-default-executor
75
91
[workload]
76
92
(case workload
77
93
:compute (make-ctp-named :compute )
78
- :io (make-ctp-named :io )
94
+ :io (make-io-executor )
79
95
:mixed (make-ctp-named :mixed )))
80
96
81
97
(def executor-for
You can’t perform that action at this time.
0 commit comments