Liking cljdoc? Tell your friends :D

qbits.knit


executorclj

(executor type)
(executor type
          &
          {:keys [thread-factory num-threads] :or {num-threads 1} :as _opts})

Returns an instances of an ExecutorService of the corresponding type.

Parameters:

  • type — the executor type, which can be :single, :cached, :fixed, :scheduled, :scheduled-single, :thread-per-task, :virtual;
  • opts — an options map that may include:
    • :thread-factory — a custom ThreadFactory instance to use for threads creation, otherwise a default one is used;
    • :num-threads — for :fixed or :scheduled executor, 1 by default.
Returns an instances of an `ExecutorService` of the corresponding type.

Parameters:
- `type` — the executor type, which can be `:single`, `:cached`, `:fixed`,
           `:scheduled`, `:scheduled-single`, `:thread-per-task`, `:virtual`;
- `opts` — an options map that may include:
  - `:thread-factory` — a custom `ThreadFactory` instance to use for threads
                        creation, otherwise a default one is used;
  - `:num-threads`    — for `:fixed` or `:scheduled` executor, 1 by default.
raw docstring

futurecljmacro

(future body-expr+ ?options)

Takes a body of expressions with the map of options and yields a future object that will invoke the body in another (executor's) thread, and will cache the result and return it on all subsequent calls to deref/@.

If the computation has not yet finished, calls to deref/@ will block, unless the variant of deref with timeout is used. See also — realized?.

A variant of the clojure.core/future that supports following options:

  • :preserve-bindings?true by default; if false, won't convey the current thread bindings to the executor thread;
  • :executor — the Agent/soloExecutor by default.
Takes a body of expressions with the map of `options` and yields a future
object that will invoke the body in another (executor's) thread, and will
cache the result and return it on all subsequent calls to `deref`/`@`.

If the computation has not yet finished, calls to `deref`/`@` will block,
unless the variant of deref with timeout is used. See also — `realized?`.

A variant of the `clojure.core/future` that supports following `options`:
- `:preserve-bindings?` — `true` by default; if `false`, won't convey the
                          current thread bindings to the executor thread;
- `:executor`           — the `Agent/soloExecutor` by default.
raw docstring

future-callclj

(future-call f
             {:keys [preserve-bindings? executor]
              :or {preserve-bindings? true executor Agent/soloExecutor}
              :as _options})

A variant of the clojure.core/future-call aux fn that supports options.

A variant of the `clojure.core/future-call` aux fn that supports `options`.
raw docstring

scheduleclj

(schedule f)
(schedule type f)
(schedule type delay f)
(schedule type
          delay
          f
          &
          {:keys [executor initial-delay unit]
           :or {initial-delay 0 unit :milliseconds}
           :as _opts})

Schedules the given fn f for execution and returns a ScheduledFuture.

Parameters:

  • f — a no-arg function to be scheduled for execution;
  • type — can be :once (default), :with-fixed-delay, :at-fixed-rate;
  • delay — for :with-fixed-delay — the delay between the termination of one execution and the commencement of the next; for :at-fixed-rate — the period between successive executions; 0 by default, i.e. no delay;
  • opts — an options map that may include:
    • :executor — a ScheduledExecutorService to schedule the task on;
    • :initial-delay — a time to delay 1st execution, in the specified unit;
    • :unit — a keywordized name of the TimeUnit enum value, :milliseconds by default.
Schedules the given fn `f` for execution and returns a `ScheduledFuture`.

Parameters:
- `f`     — a no-arg function to be scheduled for execution;
- `type`  — can be `:once` (default), `:with-fixed-delay`, `:at-fixed-rate`;
- `delay` — for `:with-fixed-delay` — the delay between the termination of
            one execution and the commencement of the next;
            for `:at-fixed-rate` — the period between successive executions;
            0 by default, i.e. no delay;
- `opts`  — an options map that may include:
  - `:executor`      — a `ScheduledExecutorService` to schedule the task on;
  - `:initial-delay` — a time to delay 1st execution, in the specified unit;
  - `:unit`          — a keywordized name of the `TimeUnit` enum value,
                       `:milliseconds` by default.
raw docstring

submitclj

(submit executor f)

Submits the given fn f to the specified executor and returns a Future.

Submits the given fn `f` to the specified `executor` and returns a `Future`.
raw docstring

thread-factoryclj

(thread-factory & {:keys [fmt priority daemon]})

Returns a new ThreadFactory instance to be used in the executor.

Returns a new `ThreadFactory` instance to be used in the `executor`.
raw docstring

thread-groupclj

(thread-group name)
(thread-group parent name)

Returns a new ThreadGroup instance to be used in the thread-factory.

Returns a new `ThreadGroup` instance to be used in the `thread-factory`.
raw docstring

time-unitsclj

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

× close