(async-execute-with-pool pool thunk)
It returns a promise which will deliver tuple of 3 values where the
first value is a the result of the execution of the thunk. The
second value is nil
when the execution is successful or :error
if the thunk throws an exception, and :queue-full
when the thread
pool can't accent any more tasks.
It returns a promise which will deliver tuple of 3 values where the first value is a the result of the execution of the thunk. The second value is `nil` when the execution is successful or `:error` if the thunk throws an exception, and `:queue-full` when the thread pool can't accent any more tasks.
(cancel task & {:keys [force] :or {force false}})
Attempts to cancel execution of this task. This attempt will fail if
the task has already completed, has already been cancelled, or could
not be cancelled for some other reason. If successful, and this task
has not started when cancel is called, this task should never
run. If the task has already started, then the :force true
parameter determines whether the thread executing this task should
be interrupted in an attempt to stop the task.
Returns false
if the task could not be cancelled, typically
because it has already completed normally; true
if the
cancellation was requested and nil
if the task was not
cancellable.
Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run. If the task has already started, then the `:force true` parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task. Returns `false` if the task could not be cancelled, typically because it has already completed normally; `true` if the cancellation was requested and `nil` if the task was not cancellable.
(execute-with-pool pool
timeout
thunk
&
{:keys [cancel-on-timeout] :or {cancel-on-timeout :always}})
It returns a promise which will deliver tuple of 3 values where the
first value is a the result of the execution of the thunk. The
second value is nil
when the execution is successful or :error
if the thunk throws an exception,:queue-full
when the thread
pool can't accent any more tasks, and :timeout
when a timeout
was reached.
It returns a promise which will deliver tuple of 3 values where the first value is a the result of the execution of the thunk. The second value is `nil` when the execution is successful or `:error` if the thunk throws an exception,`:queue-full` when the thread pool can't accent any more tasks, and `:timeout` when a timeout was reached.
(running-task-count tp)
Returns the approximate count of in flight tasks
Returns the approximate count of in flight tasks
(thread-factory prefix daemon uncaught-exception-handler)
Creates a thread factory which creates threads with the given prefix and a incremental counter. The threads can be created as daemon.
Creates a thread factory which creates threads with the given prefix and a incremental counter. The threads can be created as daemon.
(thread-pool {:keys [name core-size max-size keep-alive-time queue-size]
:or {name "safely.unnamed"
core-size 5
max-size 10
keep-alive-time 60000
queue-size 50}})
Creates a thread pool.
Creates a thread pool.
(timeout-wait value timeout cancel-strategy)
It waits on a async value up to a given timeout.
If the timeout is elapsed and the value is not available yet, then
then the task is cancelled according to the cancel-strategy
.
accepted values: :never
, :if-not-running
or :always
It waits on a async value up to a given timeout. If the timeout is elapsed and the value is not available yet, then then the task is cancelled according to the `cancel-strategy`. accepted values: `:never`, `:if-not-running` or `:always`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close