Liking cljdoc? Tell your friends :D

co.multiply.machine-latch


*assert-virtual*clj

When true (default), await throws if called from a platform thread.

Disable via:

  • JVM property: -Dco.multiply.machine-latch.assert-virtual=false
  • At runtime: (alter-var-root #'assert-virtual (constantly false))
When true (default), await throws if called from a platform thread.

Disable via:
- JVM property: -Dco.multiply.machine-latch.assert-virtual=false
- At runtime: (alter-var-root #'*assert-virtual* (constantly false))
raw docstring

at-or-past?cljmacro

(at-or-past? latch target-state)

Returns true if current state >= target-state in declared order. Non-blocking.

Returns true if current state >= target-state in declared order. Non-blocking.
raw docstring

awaitcljmacro

(await latch target-state)

Block until state >= target-state (in declared order). Returns true when reached. Must be called from a virtual thread (unless assert-virtual is false).

Block until state >= target-state (in declared order). Returns true when reached.
Must be called from a virtual thread (unless *assert-virtual* is false).
raw docstring

await-durcljmacro

(await-dur latch target-state duration)

Block until state >= target-state or timeout. Returns true if reached, false if timed out. Must be called from a virtual thread (unless assert-virtual is false).

Block until state >= target-state or timeout. Returns true if reached, false if timed out.
Must be called from a virtual thread (unless *assert-virtual* is false).
raw docstring

await-milliscljmacro

(await-millis latch target-state milliseconds)

Block until state >= target-state or timeout. Returns true if reached, false if timed out. Must be called from a virtual thread (unless assert-virtual is false).

Block until state >= target-state or timeout. Returns true if reached, false if timed out.
Must be called from a virtual thread (unless *assert-virtual* is false).
raw docstring

get-statecljmacro

(get-state latch)

Returns the current state keyword.

Returns the current state keyword.
raw docstring

machine-latch-factorycljmacro

(machine-latch-factory machine)

Returns a factory fn that creates latches for this machine.

Machine spec: {:states [:a :b :c ...] ; ordered from initial to terminal :transitions {:action {from to} ; action with single from :action2 {from1 to1, from2 to2}}} ; action with multiple froms

Pre-computes state->idx mapping and compiles transitions to use integers. Each latch instance has its own atomic state and waiter set.

Returns a factory fn that creates latches for this machine.

Machine spec:
{:states [:a :b :c ...]           ; ordered from initial to terminal
 :transitions {:action {from to}  ; action with single from
               :action2 {from1 to1, from2 to2}}}  ; action with multiple froms

Pre-computes state->idx mapping and compiles transitions to use integers.
Each latch instance has its own atomic state and waiter set.
raw docstring

throw-on-platform-park!clj

(throw-on-platform-park! bool)

Configure whether awaiting from a platform thread throws an exception. When true (default), parking a platform thread raises IllegalStateException. Set to false for testing or when platform thread parking is intentional.

Configure whether awaiting from a platform thread throws an exception.
When true (default), parking a platform thread raises IllegalStateException.
Set to false for testing or when platform thread parking is intentional.
raw docstring

transition!cljmacro

(transition! latch action)

Atomically attempt to perform action. Returns true if succeeded, false otherwise. Fails if the action is not valid from the current state.

Atomically attempt to perform action. Returns true if succeeded, false otherwise.
Fails if the action is not valid from the current state.
raw 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