Liking cljdoc? Tell your friends :D

ordered-collections.parallel

Minimal fork-join helpers for CPU-bound tree recursion.

The small set of primitives needed by the tree algorithms:

  • enter the common pool once at the root
  • fork one recursive branch
  • compute the other branch inline
  • join and combine
Minimal fork-join helpers for CPU-bound tree recursion.

The small set of primitives needed by the tree algorithms:

- enter the common pool once at the root
- fork one recursive branch
- compute the other branch inline
- join and combine
raw docstring

common-fork-join-poolclj

Shared ForkJoinPool used by collection parallel operations.

Shared ForkJoinPool used by collection parallel operations.
sourceraw docstring

fork-joincljmacro

(fork-join [left-sym left-expr right-sym right-expr] combine-expr)

Fork left-expr as a RecursiveTask, compute right-expr inline, then join.

This left-fork/right-inline shape matches the intended recursive divide-and-conquer usage: keep one branch local, make the other branch stealable by ForkJoinPool worker threads, then combine the results.

ForkJoin worker threads do not propagate Clojure dynamic bindings. Forked bodies must therefore rely only on explicit arguments captured at the parallel entry point, not on dynamic vars such as order/*compare* or tree/*t-join*.

Fork left-expr as a RecursiveTask, compute right-expr inline, then join.

This left-fork/right-inline shape matches the intended recursive
divide-and-conquer usage: keep one branch local, make the other branch
stealable by ForkJoinPool worker threads, then combine the results.

ForkJoin worker threads do not propagate Clojure dynamic bindings.
Forked bodies must therefore rely only on explicit arguments
captured at the parallel entry point, not on dynamic vars such as
`order/*compare*` or `tree/*t-join*`.
sourceraw docstring

in-fork-join-pool?clj

(in-fork-join-pool?)
source

invoke-rootclj

(invoke-root f)

Run thunk in the common pool and return its result.

This is the outer entry point into fork-join execution. Recursive work below that point should use fork-join

Run thunk in the common pool and return its result.

This is the outer entry point into fork-join execution. Recursive work
below that point should use `fork-join`
sourceraw docstring

recursive-taskclj

(recursive-task f)

Create a RecursiveTask from a nullary thunk.

This avoids the extra Callable -> ForkJoinTask adaptation layer used by ForkJoinTask/adapt while keeping task construction generic.

Create a RecursiveTask from a nullary thunk.

This avoids the extra Callable -> ForkJoinTask adaptation layer used by
ForkJoinTask/adapt while keeping task construction generic.
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