Liking cljdoc? Tell your friends :D

promesa.exec

Executors & Schedulers facilities.

Executors & Schedulers facilities.
raw docstring

*default-executor*clj/s

source

*default-scheduler*clj/s

source

cached-executorclj

(cached-executor &
                 {:keys [max-size keepalive]
                  :or {keepalive 60000 max-size Integer/MAX_VALUE}
                  :as options})

A cached thread executor pool constructor.

A cached thread executor pool constructor.
sourceraw docstring

configure-default-executorclj

(configure-default-executor & params)
source

current-threadclj

(current-thread)

Return the current thread.

Return the current thread.
sourceraw docstring

current-thread-executorclj/s

(current-thread-executor)

Creates an executor instance that run tasks in the same thread.

Creates an executor instance that run tasks in the same thread.
sourceraw docstring

default-current-thread-executorclj/s

Default Executor instance that runs the task in the same thread.

Default Executor instance that runs the task in the same thread.
sourceraw docstring

default-executorclj/s

Default executor instance, ForkJoinPool/commonPool in JVM, MicrotaskExecutor on JS.

Default executor instance, ForkJoinPool/commonPool in JVM, MicrotaskExecutor on JS.
sourceraw docstring

default-schedulerclj/s

Default scheduled executor instance.

Default scheduled executor instance.
sourceraw docstring

default-thread-factoryclj

source

default-vthread-factoryclj

source

execclj/s

(exec f)
(exec executor f)

Run the task in the provided executor, returns Promise<nil>. Analogous to the (.execute executor f). Fire and forget.

Run the task in the provided executor, returns `Promise<nil>`. Analogous to
the `(.execute executor f)`. Fire and forget.
sourceraw docstring

executor?clj/s

(executor? o)

Returns true if o is an instane of Executor or satisfies IExecutor protocol.

Returns true if `o` is an instane of Executor or satisfies IExecutor protocol.
sourceraw docstring

fixed-executorclj

(fixed-executor & {:keys [parallelism] :as options})

A fixed thread executor pool constructor.

A fixed thread executor pool constructor.
sourceraw docstring

fn->threadclj

(fn->thread f & {:keys [start] :or {start true} :as options})
source

forkjoin-executorclj

(forkjoin-executor &
                   {:keys [factory async parallelism keepalive core-size
                           max-size]
                    :or {max-size 32767 async true keepalive 60000}})
source

forkjoin-thread-factoryclj

(forkjoin-thread-factory &
                         {:keys [name daemon]
                          :or {name "promesa/forkjoin/%s" daemon true}})
source

get-available-processorsclj

(get-available-processors)
source

get-nameclj

(get-name)
(get-name thread)

Retrieve thread name

Retrieve thread name
sourceraw docstring

get-thread-idclj

(get-thread-id)
(get-thread-id thread)

Retrieves the thread ID.

Retrieves the thread ID.
sourceraw docstring

interruptclj

(interrupt)
(interrupt thread)

Interrupt a thread.

Interrupt a thread.
sourceraw docstring

interrupted?clj

(interrupted?)
(interrupted? thread)

Check if the thread has the interrupted flag set.

There are two special cases:

Using the :current keyword as argument will check the interrupted flag on the current thread.

Using the arity 0 (passing no arguments), then the current thread will be checked and WARNING the interrupted flag reset to false.

Check if the thread has the interrupted flag set.

There are two special cases:

Using the `:current` keyword as argument will check the interrupted
flag on the current thread.

Using the arity 0 (passing no arguments), then the current thread
will be checked and **WARNING** the interrupted flag reset to
`false`.
sourceraw docstring

invokeclj

(invoke context f)
(invoke context f ms-or-duration)

Execute a function f in a provided context. Optional timeout can be provided. If timeout is reached and the context allows cancellation, the task will be cancelled.

Execute a function `f` in a provided context. Optional timeout can be
provided. If timeout is reached and the context allows cancellation,
the task will be cancelled.
sourceraw docstring

microtask-executorcljs

(microtask-executor)

An IExecutor that schedules tasks to be executed in the MicrotasksQueue.

An IExecutor that schedules tasks to be executed in the MicrotasksQueue.
sourceraw docstring

pmapclj

(pmap f coll)
(pmap f coll & colls)

Analogous to the clojure.core/pmap with the exception that it allows use a custom executor (binded to default-executor var) The default clojure chunk size (32) is used for evaluation and the real parallelism is determined by the provided executor.

EXPERIMENTAL API: This function should be considered EXPERIMENTAL and may be changed or removed in future versions until this notification is removed.

Analogous to the `clojure.core/pmap` with the exception that it allows
use a custom executor (binded to *default-executor* var) The default
clojure chunk size (32) is used for evaluation and the real
parallelism is determined by the provided executor.

**EXPERIMENTAL API:** This function should be considered
EXPERIMENTAL and may be changed or removed in future versions until
this notification is removed.
sourceraw docstring

runclj/s

(run f)
(run executor f)

Run the task in the provided executor. Returns a Promise<nil>

Run the task in the provided executor. Returns a Promise<nil>
sourceraw docstring

scheduleclj/s

(schedule ms f)
(schedule scheduler ms f)

Exception safe version of schedule!. It always returns an promise instance.

Exception safe version of `schedule!`. It always returns an promise instance.
sourceraw docstring

scheduled-executorclj/s

(scheduled-executor & {:keys [parallelism] :or {parallelism 1} :as options})

A scheduled thread pool constructor. A ScheduledExecutor (IScheduler in CLJS) instance allows execute asynchronous tasks some time later.

A scheduled thread pool constructor. A ScheduledExecutor (IScheduler
in CLJS) instance allows execute asynchronous tasks some time later.
sourceraw docstring

set-thread-nameclj

(set-thread-name name)
(set-thread-name thread name)
source

shutdownclj

(shutdown executor)

Shutdowns the executor service.

Shutdowns the executor service.
sourceraw docstring

shutdown-nowclj

(shutdown-now executor)

Shutdowns and interrupts the executor service.

Shutdowns and interrupts the executor service.
sourceraw docstring

shutdown?clj

(shutdown? executor)

Check if execitor is in shutdown state.

Check if execitor is in shutdown state.
sourceraw docstring

single-executorclj

(single-executor & {:as options})

A single thread executor pool constructor.

A single thread executor pool constructor.
sourceraw docstring

sleepclj

(sleep ms)

Turn the current thread to sleep accept a number of milliseconds or Duration instance.

Turn the current thread to sleep accept a number of milliseconds or
Duration instance.
sourceraw docstring

submitclj/s

(submit f)
(submit executor f)

Exception safe version of submit!. It always returns an promise instance.

Exception safe version of `submit!`. It always returns an promise instance.
sourceraw docstring

threadcljmacro

(thread opts & body)

A low-level, not-pooled thread constructor, it accepts an optional map as first argument and the body. The options map is interepreted as options if a literal map is provided. The available options are: :name, :priority, :daemon and :virtual. The :virtual option is ignored if you are using a JVM that has no support for Virtual Threads.

A low-level, not-pooled thread constructor, it accepts an optional
map as first argument and the body. The options map is interepreted
as options if a literal map is provided. The available options are:
`:name`, `:priority`, `:daemon` and `:virtual`. The `:virtual`
option is ignored if you are using a JVM that has no support for
Virtual Threads.
sourceraw docstring

thread-callclj

(thread-call f & {:as opts})

Advanced version of p/thread-call that creates and starts a thread configured with opts. No executor service is used, this will start a plain unpooled thread; returns a non-cancellable promise instance

Advanced version of `p/thread-call` that creates and starts a thread
configured with `opts`. No executor service is used, this will start
a plain unpooled thread; returns a non-cancellable promise instance
sourceraw docstring

thread-factoryclj

(thread-factory & {:keys [name daemon priority prefix virtual]})

Create a new thread factory instance

Create a new thread factory instance
sourceraw docstring

thread-factory?clj

(thread-factory? o)

Checks if o is an instance of ThreadFactory

Checks if `o` is an instance of ThreadFactory
sourceraw docstring

thread-per-task-executorclj

(thread-per-task-executor & {:as options})
source

thread?clj

(thread? t)

Check if provided object is a thread instance.

Check if provided object is a thread instance.
sourceraw docstring

throw-uncaughtclj

(throw-uncaught cause)

Throw an exception to the current uncaught exception handler.

Throw an exception to the current uncaught exception handler.
sourceraw docstring

virtual-threads-available?clj/s

Var that indicates the availability of virtual threads.

Var that indicates the availability of virtual threads.
sourceraw docstring

vthread-per-task-executorclj

(vthread-per-task-executor)
source

with-dispatchclj/smacro

(with-dispatch executor & body)

Helper macro for dispatch execution of the body to an executor service. The returned promise is not cancellable (the body will be executed independently of the cancellation).

Helper macro for dispatch execution of the body to an executor
service. The returned promise is not cancellable (the body will be
executed independently of the cancellation).
sourceraw docstring

with-dispatch!clj/smacro

(with-dispatch! executor & body)

Blocking version of with-dispatch. Useful when you want to dispatch a blocking operation to a separated thread and join current thread waiting for result; effective when current thread is virtual thread.

Blocking version of `with-dispatch`. Useful when you want to
dispatch a blocking operation to a separated thread and join current
thread waiting for result; effective when current thread is virtual
thread.
sourceraw docstring

with-executorclj/smacro

(with-executor executor & body)

Binds the default-executor var with the provided executor, executes the macro body. It also can optionally shutdown or shutdown and interrupt on termination if you provide ^:shutdown and ^:interrupt metadata.

EXPERIMENTAL API: This function should be considered EXPERIMENTAL and may be changed or removed in future versions until this notification is removed.

Binds the *default-executor* var with the provided executor,
executes the macro body. It also can optionally shutdown or shutdown
and interrupt on termination if you provide `^:shutdown` and
`^:interrupt` metadata.

**EXPERIMENTAL API:** This function should be considered
EXPERIMENTAL and may be changed or removed in future versions until
this notification is removed.
sourceraw docstring

work-stealing-executorclj

(work-stealing-executor & params)

An alias for the forkjoin-executor.

An alias for the `forkjoin-executor`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close