@@ -205,8 +205,8 @@ IOC and vthread code.
205
205
206
206
(defparkingop <!
207
207
" takes a val from port. Must be called inside a (go ...) block, or on
208
- a virtual thread. Will return nil if closed . Will park if nothing is
209
- available."
208
+ a virtual thread (no matter how it was started) . Will return nil if
209
+ closed. Will park if nothing is available."
210
210
[port])
211
211
212
212
(defn take!
@@ -244,8 +244,8 @@ IOC and vthread code.
244
244
245
245
(defparkingop >!
246
246
" puts a val into port. nil values are not allowed. Must be called
247
- inside a (go ...) block, or on a virtual thread. Will park if no buffer
248
- space is available.
247
+ inside a (go ...) block, or on a virtual thread (no matter how it
248
+ was started). Will park if no buffer space is available.
249
249
Returns true unless port is already closed."
250
250
[port val])
251
251
@@ -387,14 +387,14 @@ IOC and vthread code.
387
387
388
388
(defparkingop alts!
389
389
" Completes at most one of several channel operations. Must be called
390
- inside a (go ...) block, or on a virtual thread. ports is a vector of
391
- channel endpoints, which can be either a channel to take from or a vector
392
- of [channel-to-put-to val-to-put], in any combination. Takes will be
393
- made as if by <!, and puts will be made as if by >!. Unless
394
- the :priority option is true, if more than one port operation is
395
- ready a non-deterministic choice will be made. If no operation is
396
- ready and a :default value is supplied, [default-val :default] will
397
- be returned, otherwise alts! will park until the first operation to
390
+ inside a (go ...) block, or on a virtual thread (no matter how it was
391
+ started). ports is a vector of channel endpoints, which can be either
392
+ a channel to take from or a vector of [channel-to-put-to val-to-put],
393
+ in any combination. Takes will be made as if by <!, and puts will be
394
+ made as if by >!. Unless the :priority option is true, if more than one
395
+ port operation is ready a non-deterministic choice will be made. If no
396
+ operation is ready and a :default value is supplied, [default-val :default]
397
+ will be returned, otherwise alts! will park until the first operation to
398
398
become ready completes. Returns [val port] of the completed
399
399
operation, where val is the value taken for takes, and a
400
400
boolean (true unless already closed, as per put!) for puts.
@@ -512,20 +512,25 @@ IOC and vthread code.
512
512
(when ret @ret)))
513
513
514
514
(defn- dynamic-require [nsym]
515
- (dispatch/ensure-clojure-version! 1 11 4 )
515
+ (dispatch/ensure-clojure-version! 1 12 3 )
516
516
(require nsym))
517
517
518
518
(defn- go* [body env]
519
- (cond (not dispatch/target-vthreads?)
520
- (do (dynamic-require 'clojure.core.async.impl.go)
521
- ((find-var 'clojure.core.async.impl.go/go-impl) env body))
522
-
523
- (or dispatch/vthreads-available-and-allowed? clojure.core/*compile-files*)
519
+ (cond (and (not dispatch/virtual-threads-available?)
520
+ dispatch/target-vthreads?
521
+ (not clojure.core/*compile-files*))
522
+ (dispatch/report-vthreads-not-available-error! )
523
+
524
+ (or dispatch/target-vthreads?
525
+ (and dispatch/unset-vthreads?
526
+ dispatch/virtual-threads-available?
527
+ (not clojure.core/*compile-files*)))
524
528
`(do (dispatch/ensure-runtime-vthreads! )
525
529
(thread-call (^:once fn* [] ~@body) :io ))
526
530
527
531
:else
528
- (dispatch/report-vthreads-not-available-error! )))
532
+ (do (dynamic-require 'clojure.core.async.impl.go)
533
+ ((find-var 'clojure.core.async.impl.go/go-impl) env body))))
529
534
530
535
(defmacro go
531
536
" Asynchronously executes the body, returning immediately to the
0 commit comments