Utility functions for core.async-based async logic.
Utility functions for core.async-based async logic.
(do-on-separate-thread f & args)
Inputs: [f & args] Returns: PromiseChan
Run (apply f args)
on a separate thread, returns a channel to fetch the results. Closing this channel early will
cancel the future running the function, if possible.
Inputs: [f & args] Returns: PromiseChan Run `(apply f args)` on a separate thread, returns a channel to fetch the results. Closing this channel early will cancel the future running the function, if possible.
(promise-canceled-chan promise-chan)
Inputs: [promise-chan :- PromiseChan] Returns: PromiseChan
Given a promise-chan
, return a new channel that will receive a single message if promise-chan
is closed before
a message is written to it (i.e. if an API request is canceled). Automatically closes after promise-chan
receives
a message or is closed.
Inputs: [promise-chan :- PromiseChan] Returns: PromiseChan Given a `promise-chan`, return a new channel that will receive a single message if `promise-chan` is closed before a message is written to it (i.e. if an API request is canceled). Automatically closes after `promise-chan` receives a message or is closed.
(promise-chan? chan)
Is core.async chan
a promise-chan
?
Is core.async `chan` a `promise-chan`?
Schema for a core.async promise channel.
Schema for a core.async promise channel.
(single-value-pipe in-chan out-chan)
Inputs: [in-chan :- ManyToManyChannel out-chan :- ManyToManyChannel] Returns: PromiseChan
Pipe that will forward a single message from in-chan
to out-chan
, closing both afterward. If out-chan
is closed
before in-chan
produces a value, closes in-chan
; this can be used to automatically cancel QP requests and the
like.
Returns a channel that will send a single message when such early-closing cancelation occurs. You can listen for
this message to implement special cancelation/close behavior, such as canceling async jobs. This channel
automatically closes when either in-chan
or out-chan
closes.
Inputs: [in-chan :- ManyToManyChannel out-chan :- ManyToManyChannel] Returns: PromiseChan Pipe that will forward a single message from `in-chan` to `out-chan`, closing both afterward. If `out-chan` is closed before `in-chan` produces a value, closes `in-chan`; this can be used to automatically cancel QP requests and the like. Returns a channel that will send a single message when such early-closing cancelation occurs. You can listen for this message to implement special cancelation/close behavior, such as canceling async jobs. This channel automatically closes when either `in-chan` or `out-chan` closes.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close