Liking cljdoc? Tell your friends :D

com.climate.claypoole.impl

Implementation helper functions for Claypoole.

Implementation helper functions for Claypoole.
raw docstring

->threadpoolclj

(->threadpool arg)

Convert the argument into a threadpool, leaving the special keyword :serial alone.

Returns [created? threadpool], where created? indicates whether a new threadpool was instantiated.

Convert the argument into a threadpool, leaving the special keyword :serial
alone.

Returns [created? threadpool], where created? indicates whether a new
threadpool was instantiated.
sourceraw docstring

apply-mapclj

(apply-map f & args)

Apply a function that takes keyword arguments to a map of arguments.

Apply a function that takes keyword arguments to a map of arguments.
sourceraw docstring

binding-conveyor-fnclj

(binding-conveyor-fn f)

Like clojure.core/binding-conveyor-fn for resetting bindings to run a function in another thread.

Like clojure.core/binding-conveyor-fn for resetting bindings to run a
function in another thread.
sourceraw docstring

default-threadpool-nameclj

(default-threadpool-name)

The default name for threads in a threadpool. Gives each threadpool a unique ID via threadpool-id.

The default name for threads in a threadpool. Gives each threadpool a
unique ID via threadpool-id.
sourceraw docstring

deref-fixing-exceptionsclj

(deref-fixing-exceptions fut)

If a future experiences an exception and you dereference the future, you will see not the original exception but a java.util.concurrent.ExecutionException. That's sometimes not the result you want. This catches those exceptions and re-throws the future's exception, which can be much less surprising to downstream code.

If a future experiences an exception and you dereference the future, you
will see not the original exception but a
java.util.concurrent.ExecutionException. That's sometimes not the result you
want. This catches those exceptions and re-throws the future's exception,
which can be much less surprising to downstream code.
sourceraw docstring

deref-futureclj

(deref-future fut)
(deref-future fut timeout-ms timeout-val)

Like clojure.core/deref-future.

Like clojure.core/deref-future.
sourceraw docstring

dummy-future-callclj

(dummy-future-call f)

A dummy future-call that runs in serial and returns a future containing the result.

A dummy future-call that runs in serial and returns a future containing the
result.
sourceraw docstring

get-pool-sizeclj

(get-pool-size pool)

If the pool has a max size, get that; else, return nil.

If the pool has a max size, get that; else, return nil.
sourceraw docstring

lazy-co-readclj

(lazy-co-read s1 s2)

Zip s1 and s2, stopping when s1 stops. This helps avoid potential blocking when trying to read queue sequences.

In particular, this will block: (map vector (range 10) (concat (range 10) (lazy-seq (deref (promise))))) even though we only can read 10 things. Lazy-co-read fixes that case by checking the first sequence first, so this will not block: (lazy-co-read (range 10) (concat (range 10) (lazy-seq (deref (promise)))))

Zip s1 and s2, stopping when s1 stops. This helps avoid potential blocking
when trying to read queue sequences.

In particular, this will block:
  (map vector
       (range 10)
       (concat (range 10) (lazy-seq (deref (promise)))))
even though we only can read 10 things. Lazy-co-read fixes that case by
checking the first sequence first, so this will not block:
  (lazy-co-read
    (range 10)
    (concat (range 10) (lazy-seq (deref (promise)))))
sourceraw docstring

pfor-internalclj

(pfor-internal pool bindings body pmap-fn-sym)

Do the messy parsing of the :priority from the for bindings.

Do the messy parsing of the :priority from the for bindings.
sourceraw docstring

queue-seqclj

(queue-seq)

Create a queue and a lazy sequence that reads from that queue.

Create a queue and a lazy sequence that reads from that queue.
sourceraw docstring

queue-seq-add!clj

(queue-seq-add! q x)

Add an item to a queue (and its lazy sequence).

Add an item to a queue (and its lazy sequence).
sourceraw docstring

queue-seq-end!clj

(queue-seq-end! q)

End a lazy sequence reading from a queue.

End a lazy sequence reading from a queue.
sourceraw docstring

seq-openclj

(seq-open f s)

Converts a seq s into a lazy seq that calls a function f when the seq is fully realized or when an exception is thrown. Sort of like with-open, but not a macro, not necessarily calling .close, and for a lazy seq.

Converts a seq s into a lazy seq that calls a function f when the seq is
fully realized or when an exception is thrown. Sort of like with-open, but
not a macro, not necessarily calling .close, and for a lazy seq.
sourceraw docstring

thread-factoryclj

(thread-factory
  &
  {:keys [daemon thread-priority] pool-name :name :or {daemon true}})

Create a ThreadFactory with keyword options including thread daemon status :daemon, the thread name format :name (a string for format with one integer), and a thread priority :thread-priority.

Create a ThreadFactory with keyword options including thread daemon status
:daemon, the thread name format :name (a string for format with one integer),
and a thread priority :thread-priority.
sourceraw docstring

threadpoolclj

(threadpool n & args)

Make a threadpool. It should be shutdown when no longer needed.

See docs in com.climate.claypoole/threadpool.

Make a threadpool. It should be shutdown when no longer needed.

See docs in com.climate.claypoole/threadpool.
sourceraw docstring

threadpool-idclj

The previously-used threadpool ID.

The previously-used threadpool ID.
sourceraw docstring

unchunkclj

(unchunk s)
Takes a seqable and returns a lazy sequence that is maximally lazy.

Based on http://stackoverflow.com/questions/3407876/how-do-i-avoid-clojures-chunking-behavior-for-lazy-seqs-that-i-want-to-short-ci
sourceraw docstring

validate-future-poolclj

(validate-future-pool pool)

Verify that a threadpool is a valid pool for a future.

Verify that a threadpool is a valid pool for a future.
sourceraw docstring

with-priority-fnclj

(with-priority-fn pool priority-fn)

Make a priority-threadpool wrapper that uses a given priority function.

The priority function is applied to a pmap'd function's arguments. e.g.

(upmap (with-priority-fn p (fn [x _] x)) + [6 5 4] [1 2 3])

will use pool p to run tasks [(+ 6 1) (+ 5 2) (+ 4 3)] with priorities [6 5 4].

Make a priority-threadpool wrapper that uses a given priority function.

The priority function is applied to a pmap'd function's arguments. e.g.

  (upmap (with-priority-fn p (fn [x _] x)) + [6 5 4] [1 2 3])

will use pool p to run tasks [(+ 6 1) (+ 5 2) (+ 4 3)]
with priorities [6 5 4].
sourceraw docstring

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

× close