When true (default), await throws if called from a platform thread.
Disable via:
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))
(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.
(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).
(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).
(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).
(get-state latch)Returns the current state keyword.
Returns the current state keyword.
(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.(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.
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |