Provide a variant of core.async/go
that works with manifold's deferreds and executors. Utilizes core.async's state-machine generator, so core.async must be available as a dependency.
Provide a variant of `core.async/go` that works with manifold's deferreds and executors. Utilizes core.async's state-machine generator, so core.async must be available as a dependency.
(<!-no-throw port)
takes value from deferred. Must be called inside a (go ...) block. Will return nil if closed. Will park if nothing is available. If an error is thrown inside the body, that error will be placed as the return value.
N.B. To make tsasvla
usage idiomatic with the rest of manifold, use <!?
instead of this directly.
takes value from deferred. Must be called inside a (go ...) block. Will return nil if closed. Will park if nothing is available. If an error is thrown inside the body, that error will be placed as the return value. N.B. To make `tsasvla` usage idiomatic with the rest of manifold, use `<!?` instead of this directly.
(<!? port)
takes a val from port. Must be called inside a (tsasvla ...) block. Will park if nothing is available. If value that is returned is a Throwable, will re-throw.
takes a val from port. Must be called inside a (tsasvla ...) block. Will park if nothing is available. If value that is returned is a Throwable, will re-throw.
(tsasvla & body)
წასვლა - Georgian for "to go" Asynchronously executes the body on manifold's default executor, returning immediately to the calling thread. Additionally, any visible calls to <!? and <!-no-throw deferred operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed.
Returns a deferred which will receive the result of the body when completed. If the body returns a deferred, the result will be unwrapped until a non-deferable value is available to be placed onto the return deferred.
This method is intended to be similar to core.async/go
, and even utilizes the
underlying state machine related functions from core.async
. It's been designed
to address the following major points from core.async & vanilla manifold deferreds:
core.async/go
assumes that all of your code is able to be purely async
and will never block the handling threads. Tsasvla removes the concept of handling
threads, which means blocking is not an issue, but if you spawn too many of these you
can create too many threads for the OS to handle.core.async/go
has absolutely no way of bubbling up exceptions and assumes all
code will be defensively written, which differs from how clojure code blocks work
outside of the async world.deferred/let-flow
presumes that every deferrable needs to be resolved. This prevents
more complex handling of parallelism or being able to pass deferreds into other functions
from within the let-flow
blockdeferred/chain
only works with single deferreds, which means having to write code in
unnatural ways to handle multiple deferreds.წასვლა - Georgian for "to go" Asynchronously executes the body on manifold's default executor, returning immediately to the calling thread. Additionally, any visible calls to <!? and <!-no-throw deferred operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. Returns a deferred which will receive the result of the body when completed. If the body returns a deferred, the result will be unwrapped until a non-deferable value is available to be placed onto the return deferred. This method is intended to be similar to `core.async/go`, and even utilizes the underlying state machine related functions from `core.async`. It's been designed to address the following major points from core.async & vanilla manifold deferreds: - `core.async/go` assumes that all of your code is able to be purely async and will never block the handling threads. Tsasvla removes the concept of handling threads, which means blocking is not an issue, but if you spawn too many of these you can create too many threads for the OS to handle. - `core.async/go` has absolutely no way of bubbling up exceptions and assumes all code will be defensively written, which differs from how clojure code blocks work outside of the async world. - `deferred/let-flow` presumes that every deferrable needs to be resolved. This prevents more complex handling of parallelism or being able to pass deferreds into other functions from within the `let-flow` block - `deferred/chain` only works with single deferreds, which means having to write code in unnatural ways to handle multiple deferreds.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close