Liking cljdoc? Tell your friends :D

task.core


cancelledclj/s

source

do!clj/s

(do! t)

Starts given task, memoizes result and returns a task always completing with that result.

Starts given task, memoizes result and returns a task always completing with that result.
sourceraw docstring

do!!clj/s

(do!! task)

Runs given task, blocking thread until termination. Returns on success, throws on failure. Host platform must support thread suspension.

Runs given task, blocking thread until termination. Returns on success, throws on failure. Host platform must support thread suspension.
sourceraw docstring

effectclj/s≠macro

clj
(effect & body)
cljs
(effect &form &env & body)

Returns a task completing with result of body evaluation, which must be free of blocking calls.

Returns a task completing with result of body evaluation, which must be free of blocking calls.
source (clj)source (cljs)raw docstring

effect-offclj/s≠macro

clj
(effect-off & body)
cljs
(effect-off &form &env & body)

Returns a task completing with result of body evaluation, which may have blocking calls.

Returns a task completing with result of body evaluation, which may have blocking calls.
source (clj)source (cljs)raw docstring

elseclj/s

(else task f & args)

Returns a task completing with result of input task if successful, otherwise applying f to the error along with optional extra arguments. f must return a task that will be run to yield the final result.

Returns a task completing with result of input task if successful, otherwise applying f to the error along with optional extra arguments. f must return a task that will be run to yield the final result.
sourceraw docstring

else*clj/s

(else* event t f)
(else* event t f a)
(else* event t f a b)
(else* event t f a b c)
(else* event t f a b c & ds)

Else task boot function (cf else).

Else task boot function (cf else).
sourceraw docstring

failureclj/s

(failure error)

Returns a task immediately failing with given error.

Returns a task immediately failing with given error.
sourceraw docstring

joinclj/s

(join f & tasks)

Returns a task running given tasks in parallel and completing with application of function f to results. Input task failures propagate to returned task and cancel tasks still pending.

Returns a task running given tasks in parallel and completing with application of function f to results. Input task failures propagate to returned task and cancel tasks still pending.
sourceraw docstring

join*clj/s

(join* event f & ts)

Join task boot function (cf join).

Join task boot function (cf join).
sourceraw docstring

pendingclj/s

(pending x)

Sentinel function. Returns true if called on itself, false otherwise.

Sentinel function. Returns true if called on itself, false otherwise.
sourceraw docstring

promiseclj/s

(promise)

Returns a completable and memoized task. The task completes with the first result of any task given to the extra 1-arity.

Returns a completable and memoized task. The task completes with the first result of any task given to the extra 1-arity.
sourceraw docstring

raceclj/s

(race & tasks)

Returns a task running given tasks in parallel and completing with first succeeding result, cancelling late tasks.

Returns a task running given tasks in parallel and completing with first succeeding result, cancelling late tasks.
sourceraw docstring

race*clj/s

(race* event & ts)

Race task boot function (cf race).

Race task boot function (cf race).
sourceraw docstring

successclj/s

(success value)

Returns a task immediately succeeding with given value.

Returns a task immediately succeeding with given value.
sourceraw docstring

taskclj/s

(task boot & args)

Returns a task backed by an event loop. This helper provides a basis for definition of asynchronous stateful processes, enforcing sequential handling of possibly concurrent events. When the task is started, boot function is first called with a fresh event wrapper along with optional extra arguments, and is expected to return the handler function for the task's cancellation signal. The event wrapper is a 1-arity function taking a handler function and returning a signal function. The signal function is thread-safe, non-blocking, non-throwing, returns nil, and its effect is to schedule the execution of the handler function in the event loop. A handler function is called at most once for each call to its signal function. The result of a handler function defines the task's current status. Throwing an exception signals task failure, returning the sentinel value pending signals the task is still waiting for an event, returning any other value signals task success. Success and failure trigger a call to their associated continuation and stop event processing, discarding subsequent events. Events occuring during execution of the boot function are delayed until the boot function returns. All handler functions wrapped by the same event wrapper will be run on a cpu-bound thread pool sequentially, so they may safely share unsynchronized mutable state.

Returns a task backed by an event loop. This helper provides a basis for definition of asynchronous stateful processes, enforcing sequential handling of possibly concurrent events.
When the task is started, boot function is first called with a fresh event wrapper along with optional extra arguments, and is expected to return the handler function for the task's cancellation signal. The event wrapper is a 1-arity function taking a handler function and returning a signal function. The signal function is thread-safe, non-blocking, non-throwing, returns nil, and its effect is to schedule the execution of the handler function in the event loop. A handler function is called at most once for each call to its signal function.
The result of a handler function defines the task's current status. Throwing an exception signals task failure, returning the sentinel value `pending` signals the task is still waiting for an event, returning any other value signals task success. Success and failure trigger a call to their associated continuation and stop event processing, discarding subsequent events.
Events occuring during execution of the boot function are delayed until the boot function returns. All handler functions wrapped by the same event wrapper will be run on a cpu-bound thread pool sequentially, so they may safely share unsynchronized mutable state.
sourceraw docstring

task-viaclj/s

(task-via exec! boot)
(task-via exec! boot a)
(task-via exec! boot a b)
(task-via exec! boot a b c)
(task-via exec! boot a b c & ds)

Returns a task backed by an event loop, running on supplied executor (cf task).

Returns a task backed by an event loop, running on supplied executor (cf task).
sourceraw docstring

thenclj/s

(then task f & args)

Returns a task running input task, then if successful passing result to function f along with optional extra arguments. f must return a task that will be runned to yield the final result.

Returns a task running input task, then if successful passing result to function f along with optional extra arguments. f must return a task that will be runned to yield the final result.
sourceraw docstring

then*clj/s

(then* event t f)
(then* event t f a)
(then* event t f a b)
(then* event t f a b c)
(then* event t f a b c & ds)

Then task boot function (cf then).

Then task boot function (cf then).
sourceraw docstring

timeoutclj/s

(timeout delay value)

Returns a task succeeding with given value after given delay, in milliseconds.

Returns a task succeeding with given value after given delay, in milliseconds.
sourceraw docstring

tletclj/s≠macro

clj
(tlet bindings & body)
cljs
(tlet &form &env bindings & body)

Task let. Returns a task sequentially running each task returned by evaluation of right expressions, binding each result to left symbol if successful, then completing with body evaluation.

Task let. Returns a task sequentially running each task returned by evaluation of right expressions, binding each result to left symbol if successful, then completing with body evaluation.
source (clj)source (cljs)raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close