Liking cljdoc? Tell your friends :D

fx.async

Structured concurrency, fibers, parallel combinators, and execution scopes for fx.

Structured concurrency, fibers, parallel combinators, and execution scopes for fx.
raw docstring

all-par>clj/s

(all-par> effects)
(all-par> a b)
(all-par> prev-effect effects opts)

Executes a collection of effects in parallel and returns a vector of results. By default short-circuits (fail-fast) on first failure, cancelling peer fibers. Options map: :concurrency - maximum concurrent tasks (default: unbounded) :fail-fast? - boolean whether to halt on first failure (default: true)

Executes a collection of effects in parallel and returns a vector of results.
By default short-circuits (fail-fast) on first failure, cancelling peer fibers.
Options map:
  `:concurrency` - maximum concurrent tasks (default: unbounded)
  `:fail-fast?`  - boolean whether to halt on first failure (default: true)
raw docstring

chan-alts>clj/s


chan-close>clj/s


chan-drain>clj/s


chan-pipe>clj/s


chan-pub>clj/s


chan-put>clj/s


chan-sub>clj/s


chan-take>clj/s


chan-unsub>clj/s


chan>clj/s


countdown-latch>clj/s


deferred-await>clj/s


deferred-fail>clj/s


deferred-succeed>clj/s


deferred>clj/s


deferred?clj/s


fiber-childrenclj/s


fiber-idclj/s


fiber-resultclj/s


fiber-statusclj/s


fiber-status-atomclj/s


fiber-status>clj/s

(fiber-status>)
(fiber-status> target-or-prev)
(fiber-status> prev-effect target-fiber)

Creates an effect that queries the status (:running, :succeeded, :failed, :interrupted) of fiber or the currently executing fiber if none provided.

Creates an effect that queries the status (:running, :succeeded, :failed, :interrupted) of `fiber`
or the currently executing fiber if none provided.
raw docstring

fiber?clj/s


fork>clj/s

(fork> target-effect)
(fork> prev-effect target-effect)

Creates an effect that forks target-effect into a background fiber and yields the IFiber reference. Supports threading upstream effect: (-> eff (fork>)) or standalone (fork> eff).

Creates an effect that forks `target-effect` into a background fiber and yields the `IFiber` reference.
Supports threading upstream effect: `(-> eff (fork>))` or standalone `(fork> eff)`.
raw docstring

hub-bounded>clj/s


hub-publish>clj/s


hub-shutdown>clj/s


hub-subscribe>clj/s


hub-subscriber-count>clj/s


hub-unsubscribe>clj/s


hub?clj/s


interrupt-fiber!clj/s


interrupt>clj/s

(interrupt>)
(interrupt> target-or-prev)
(interrupt> target-or-prev reason-or-target)
(interrupt> prev-effect target-fiber reason)

Creates an effect that interrupts fiber and cascades cancellation to all child fibers.

Creates an effect that interrupts `fiber` and cascades cancellation to all child fibers.
raw docstring

join-fiber!clj/s


join>clj/s

(join>)
(join> target-or-prev)
(join> prev-effect target-or-opts)

Creates an effect that awaits completion of fiber and yields its outcome or propagates failure. Optional opts map may contain :timeout-ms and :timeout-val.

Creates an effect that awaits completion of `fiber` and yields its outcome or propagates failure.
Optional `opts` map may contain `:timeout-ms` and `:timeout-val`.
raw docstring

latch-await>clj/s


latch-count-down>clj/s


latch-get-count>clj/s


latch?clj/s


map-par>clj/s

(map-par> f)
(map-par> a b)
(map-par> a b c)
(map-par> prev-effect f coll opts)

Applies effect-producing function f concurrently across elements in coll and collects results. Options map: :concurrency - maximum concurrent executions (default: unbounded / worker pool) :fail-fast? - boolean whether to cancel peer tasks on failure (default: true)

Examples: (map-par> (fn [x] (fetch-item> x)) item-ids {:concurrency 4}) (-> items (map-par> (fn [x] (process> x)) {:concurrency 2}))

Applies effect-producing function `f` concurrently across elements in `coll` and collects results.
Options map:
  `:concurrency` - maximum concurrent executions (default: unbounded / worker pool)
  `:fail-fast?`  - boolean whether to cancel peer tasks on failure (default: true)

Examples:
  (map-par> (fn [x] (fetch-item> x)) item-ids {:concurrency 4})
  (-> items (map-par> (fn [x] (process> x)) {:concurrency 2}))
raw docstring

queue-bounded>clj/s


queue-dropping>clj/s


queue-offer>clj/s


queue-poll>clj/s


queue-shutdown>clj/s


queue-size>clj/s


queue-sliding>clj/s


queue-take>clj/s


queue-unbounded>clj/s


queue?clj/s


race>clj/s

(race> effects)
(race> prev-effect effects)

Races a collection of effects concurrently, returning the outcome of the first successful effect and cancelling all other competitors. If all fail, yields the final failure.

Races a collection of effects concurrently, returning the outcome of the first successful effect
and cancelling all other competitors. If all fail, yields the final failure.
raw docstring

ref-get>clj/s


ref-set>clj/s


ref-update>clj/s


ref>clj/s


ref?clj/s


run-async-chan!clj/s


run-fiber!clj/s


semaphore-acquire>clj/s


semaphore-available-permits>clj/s


semaphore-release>clj/s


semaphore>clj/s


semaphore?clj/s


with-go>clj/s

(with-go> target-effect)
(with-go> prev-effect target-effect)

Scopes execution of effect to core.async go-routines.

Scopes execution of `effect` to `core.async` go-routines.
raw docstring

with-permit>clj/s


with-thread-pool>clj/s

(with-thread-pool> executor-or-eff)
(with-thread-pool> prev-or-exec target-or-exec)
(with-thread-pool> prev-effect executor target-effect)

Scopes execution of effect to an explicit Java ExecutorService or fixed thread pool.

Scopes execution of `effect` to an explicit Java `ExecutorService` or fixed thread pool.
raw docstring

with-virtual-threads>clj/s

(with-virtual-threads> target-effect)
(with-virtual-threads> prev-effect target-effect)

Scopes execution of effect to Java Virtual Threads.

Scopes execution of `effect` to Java Virtual Threads.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close