@@ -40,34 +40,7 @@ core.async. If not supplied, the Executor for :io will be
4040used instead.
4141
4242The set of contexts may grow in the future so the function should
43- return nil for unexpected contexts.
44-
45- Use the Java system property `clojure.core.async.vthreads` to control
46- how core.async uses JDK 21+ virtual threads. The property can be one of
47- the following values:
48-
49- unset - core.async will opportunistically use vthreads when available
50- (≥ Java 21) and will otherwise use the old IOC impl. io-thread and :io
51- thread pool will run on platform threads if vthreads are not available.
52- If AOT compiling, go blocks will always use IOC so that the resulting
53- bytecode works on all JVMs (so no change in compiled output)
54-
55- \" target\" - means that you are targeting virtual threads. At runtime
56- from source, go blocks will throw if vthreads are not available.
57- If AOT compiling, go blocks are always compiled as normal Clojure
58- code to be run on vthreads and will throw at runtime if vthreads are
59- not available (Java <21)
60-
61- \" avoid\" - means that vthreads will not be used by core.async - you can
62- use this to minimize impacts if you are not yet ready to utilize vthreads
63- in your app. If AOT compiling, go blocks will use IOC. At runtime, io-thread
64- and the :io thread pool use platform threads
65-
66- Note: existing IOC compiled go blocks from older core.async versions continue
67- to work (we retain and load the IOC state machine runtime - this does not
68- require the analyzer), and you can interact with the same channels from both
69- IOC and vthread code.
70- "
43+ return nil for unexpected contexts."
7144 (:refer-clojure :exclude [reduce transduce into merge map take partition
7245 partition-by bounded-count])
7346 (:require [clojure.core.async.impl.protocols :as impl]
@@ -516,22 +489,6 @@ IOC and vthread code.
516489 (let [ret (impl/take! port (fn-handler nop false ))]
517490 (when ret @ret)))
518491
519- (defn- go* [body env]
520- (cond (and (not dispatch/virtual-threads-available?)
521- dispatch/target-vthreads?
522- (not clojure.core/*compile-files*))
523- (dispatch/report-vthreads-not-available-error! )
524-
525- (or dispatch/target-vthreads?
526- (and dispatch/unset-vthreads?
527- dispatch/virtual-threads-available?
528- (not clojure.core/*compile-files*)))
529- `(do (dispatch/ensure-runtime-vthreads! )
530- (thread-call (^:once fn* [] ~@body) :io ))
531-
532- :else
533- ((requiring-resolve 'clojure.core.async.impl.go/go-impl) env body)))
534-
535492(defmacro go
536493 " Asynchronously executes the body, returning immediately to the
537494 calling thread. Additionally, any visible calls to <!, >! and alt!/alts!
@@ -548,7 +505,7 @@ IOC and vthread code.
548505 Returns a channel which will receive the result of the body when
549506 completed"
550507 [& body]
551- (go* body &env))
508+ (( requiring-resolve 'clojure.core.async.impl.go/go-impl) &env body ))
552509
553510(defonce ^:private thread-macro-executor nil )
554511
0 commit comments