(?)
(? task)
0-arity : throws an exception if termination has been requested, else returns nil. Checks task cancellation inside sp blocks, thread interruption outside. 1-arity : executes given task and waits for its completion. Parks process inside sp blocks, blocks thread outside.
0-arity : throws an exception if termination has been requested, else returns nil. Checks task cancellation inside sp blocks, thread interruption outside. 1-arity : executes given task and waits for its completion. Parks process inside sp blocks, blocks thread outside.
(blk & body)
(blk &form &env & body)
Returns a task evaluating body in an unbounded thread pool and completing with its result. Cancelling the task will interrupt the thread running it.
Returns a task evaluating body in an unbounded thread pool and completing with its result. Cancelling the task will interrupt the thread running it.
(buf)
Creates a non-backpressured buffer. Returned object is a function implementing enqueue on 1-arity and dequeue on 2-arity. Enqueue immediately appends given value to buffer and returns nil. Dequeue is a task removing the first value from buffer as soon as it's non-empty and completing with this value. Cancelling a dequeuing task makes it fail immediately.
Creates a non-backpressured buffer. Returned object is a function implementing enqueue on 1-arity and dequeue on 2-arity. Enqueue immediately appends given value to buffer and returns nil. Dequeue is a task removing the first value from buffer as soon as it's non-empty and completing with this value. Cancelling a dequeuing task makes it fail immediately.
(compel task)
Prevents given task from cancellation.
Prevents given task from cancellation.
(cpu & body)
(cpu &form &env & body)
Returns a task evaluating body in a fixed size thread pool and completing with its result. Cancelling the task will interrupt the thread running it.
Returns a task evaluating body in a fixed size thread pool and completing with its result. Cancelling the task will interrupt the thread running it.
(dfv)
Creates a dataflow (single-assignment) variable. Returned object is a function implementing assignment on 1-arity and dereference on 2-arity. Assignment immediately binds the variable to given value if not already bound and returns nil. Dereference is a task completing with the value bound to the variable as soon as it's available. Cancelling a dereferencing task makes it fail immediately.
Creates a dataflow (single-assignment) variable. Returned object is a function implementing assignment on 1-arity and dereference on 2-arity. Assignment immediately binds the variable to given value if not already bound and returns nil. Dereference is a task completing with the value bound to the variable as soon as it's available. Cancelling a dereferencing task makes it fail immediately.
(holding lock & body)
(holding &form &env lock & body)
Acquires given semaphore and evaluates body, ensuring semaphore is released after evaluation.
Acquires given semaphore and evaluates body, ensuring semaphore is released after evaluation.
(join)
(join & ts)
Takes an arbitrary number of tasks and returns a task executing them concurrently, completing with the vector of results unless any of them fails. When the first failure happens, parent task will fail after having pending tasks cancelled and awaited for completion, discarding results. Cancellation signal on parent task is propagated to children tasks.
Takes an arbitrary number of tasks and returns a task executing them concurrently, completing with the vector of results unless any of them fails. When the first failure happens, parent task will fail after having pending tasks cancelled and awaited for completion, discarding results. Cancellation signal on parent task is propagated to children tasks.
(race & tasks)
Takes an arbitrary number of tasks and returns a task executing them concurrently, completing with the first successful result unless all of them fails. When the first success happens, parent task will succeed after having pending tasks cancelled and awaited for completion, discarding results. Cancellation signal on parent task is propagated to children tasks.
Takes an arbitrary number of tasks and returns a task executing them concurrently, completing with the first successful result unless all of them fails. When the first success happens, parent task will succeed after having pending tasks cancelled and awaited for completion, discarding results. Cancellation signal on parent task is propagated to children tasks.
(rdv)
Creates a synchronous rendez-vous. Returned object is a function implementing give on its 1-arity and take on its 2-arity. Give takes the value to transfer and returns a task completing with nil as soon as a taker is available. Take is a task completing with transferred value as soon as a giver is available. Cancelling giving and taking tasks makes them fail immediately.
Creates a synchronous rendez-vous. Returned object is a function implementing give on its 1-arity and take on its 2-arity. Give takes the value to transfer and returns a task completing with nil as soon as a taker is available. Take is a task completing with transferred value as soon as a giver is available. Cancelling giving and taking tasks makes them fail immediately.
(sem)
(sem n)
Creates a semaphore initialized with n tokens (1 if not provided, aka mutex). Returned object is a function implementing release on 0-arity and acquire on 2-arity. Release immediately makes a token available and returns nil. Acquire is a task completing with nil as soon as a token is available. Cancelling an acquiring task makes it fail immediately.
Creates a semaphore initialized with n tokens (1 if not provided, aka mutex). Returned object is a function implementing release on 0-arity and acquire on 2-arity. Release immediately makes a token available and returns nil. Acquire is a task completing with nil as soon as a token is available. Cancelling an acquiring task makes it fail immediately.
(sleep d)
(sleep d x)
Returns a task completing with given value (nil if not provided) after given duration (in milliseconds). Cancelling a sleep task makes it fail immediately.
Returns a task completing with given value (nil if not provided) after given duration (in milliseconds). Cancelling a sleep task makes it fail immediately.
(sp & body)
(sp &form &env & body)
Returns a task evaluating body, which must be cpu-bound, and completing with its result. Cancelling an sp task will cancel the execution of the task it's currently waiting for, and all tasks subsequently executed will be immediately cancelled.
Returns a task evaluating body, which must be cpu-bound, and completing with its result. Cancelling an sp task will cancel the execution of the task it's currently waiting for, and all tasks subsequently executed will be immediately cancelled.
(timeout delay task)
Returns a task executing given task, cancelling it if not completed within given duration (in milliseconds).
Returns a task executing given task, cancelling it if not completed within given duration (in milliseconds).
(via exec & body)
(via &form &env exec & body)
Returns a task evaluating body via given java.concurrent.Executor and completing with its result. Cancelling the task will interrupt the thread running it.
Returns a task evaluating body via given java.concurrent.Executor and completing with its result. Cancelling the task will interrupt the thread running it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close