@@ -53,10 +53,10 @@ If AOT compiling, go blocks will always use IOC so that the resulting
53
53
bytecode works on all JVMs (so no change in compiled output)
54
54
55
55
\" target\" - means that you are targeting virtual threads. At runtime
56
- from source, go blocks will use vthreads if available, but will fall back
57
- to IOC if not available. If AOT compiling, go blocks are always compiled
58
- as normal Clojure code to be run on vthreads and will throw at runtime
59
- if vthreads are not available (Java <21)
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
60
61
61
\" avoid\" - means that vthreads will not be used by core.async - you can
62
62
use this to minimize impacts if you are not yet ready to utilize vthreads
@@ -558,9 +558,12 @@ IOC and vthread code.
558
558
(if (not (dispatch/target-vthreads? ))
559
559
(do (require-fresh 'clojure.core.async.impl.go)
560
560
((find-var 'clojure.core.async.impl.go/go-impl) &env body))
561
- `(do ~(when clojure.core/*compile-files*
562
- `(dispatch/ensure-runtime-vthreads!))
563
- (thread-call (^:once fn* [] ~@body) :io ))))
561
+ (if (and (not (dispatch/vthreads-available-and-allowed? ))
562
+ (not clojure.core/*compile-files*))
563
+ (do (dispatch/ensure-runtime-vthreads! )
564
+ `(thread-call (^:once fn* [] ~@body) :io ))
565
+ `(do (dispatch/ensure-runtime-vthreads! )
566
+ (thread-call (^:once fn* [] ~@body) :io )))))
564
567
565
568
(defonce ^:private thread-macro-executor nil )
566
569
0 commit comments