Core protocols for fibers, queues, coordination, and async communication in fx.
Core protocols for fibers, queues, coordination, and async communication in fx.
(deferred? x)Returns true if x satisfies the IDeferred protocol.
Returns true if `x` satisfies the IDeferred protocol.
(fiber-children fiber)(fiber-id fiber)(fiber-result fiber)(fiber-status fiber)(fiber-status-atom fiber)(fiber? x)Returns true if x satisfies the IFiber protocol.
Returns true if `x` satisfies the IFiber protocol.
(hub? x)Returns true if x satisfies the IHub protocol.
Returns true if `x` satisfies the IHub protocol.
Protocol for single-assignment async deferred values.
Protocol for single-assignment async deferred values.
(-deferred-await! this)(-deferred-await! this timeout-ms timeout-val)Awaits completion of the deferred, returning the value or throwing if failed/timed out.
Awaits completion of the deferred, returning the value or throwing if failed/timed out.
(-deferred-completed? this)Returns true if the deferred has already been completed.
Returns true if the deferred has already been completed.
(-deferred-fail! this failure-or-err)Completes the deferred with a failure or exception. Returns true if first to complete.
Completes the deferred with a failure or exception. Returns true if first to complete.
(-deferred-succeed! this val)Completes the deferred successfully with val. Returns true if first to complete.
Completes the deferred successfully with `val`. Returns true if first to complete.
Protocol representing a lightweight, structured fiber of computation.
Protocol representing a lightweight, structured fiber of computation.
(-fiber-children this)Returns an atom containing the set of active child fibers.
Returns an atom containing the set of active child fibers.
(-fiber-id this)Returns the unique identifier of the fiber.
Returns the unique identifier of the fiber.
(-fiber-interrupt! this)(-fiber-interrupt! this reason)Interrupts the fiber and cascades cancellation across all active child fibers.
Interrupts the fiber and cascades cancellation across all active child fibers.
(-fiber-result this)Returns a CompletableFuture or promise holding the eventual value or failure.
Returns a CompletableFuture or promise holding the eventual value or failure.
(-fiber-status this)Returns the current lifecycle status keyword: :running, :succeeded, :failed, or :interrupted.
Returns the current lifecycle status keyword: :running, :succeeded, :failed, or :interrupted.
(-fiber-status-atom this)Returns the internal atomic reference containing the fiber's status keyword.
Returns the internal atomic reference containing the fiber's status keyword.
Protocol for multi-producer multi-consumer broadcast Hubs.
Protocol for multi-producer multi-consumer broadcast Hubs.
(-hub-publish! this item)Publishes an item to all active subscribers. Returns count of active recipients.
Publishes an item to all active subscribers. Returns count of active recipients.
(-hub-shutdown! this)Closes the Hub and shuts down all active subscription queues.
Closes the Hub and shuts down all active subscription queues.
(-hub-subscribe! this)Creates and returns a new subscription Queue for a subscriber.
Creates and returns a new subscription Queue for a subscriber.
(-hub-subscriber-count this)Returns the number of currently active subscriber queues.
Returns the number of currently active subscriber queues.
(-hub-unsubscribe! this sub-queue)Unregisters a subscriber queue from receiving future broadcast messages.
Unregisters a subscriber queue from receiving future broadcast messages.
Protocol for countdown synchronization latches.
Protocol for countdown synchronization latches.
(-latch-await! this)(-latch-await! this timeout-ms)Awaits until the latch count reaches 0, or timeout expires. Returns boolean.
Awaits until the latch count reaches 0, or timeout expires. Returns boolean.
(-latch-count-down! this)Decrements the latch count, releasing all waiting callers when count reaches 0.
Decrements the latch count, releasing all waiting callers when count reaches 0.
(-latch-get-count this)Returns the current remaining count.
Returns the current remaining count.
Protocol for backpressure-aware, multi-producer multi-consumer async queues.
Protocol for backpressure-aware, multi-producer multi-consumer async queues.
(-queue-capacity this)Returns the maximum capacity of the queue, or nil if unbounded.
Returns the maximum capacity of the queue, or nil if unbounded.
(-queue-offer! this item)Offers an item to the queue. Returns true if accepted, false if capacity full and non-blocking.
Offers an item to the queue. Returns true if accepted, false if capacity full and non-blocking.
(-queue-poll! this)Takes an item immediately without parking; returns nil if empty.
Takes an item immediately without parking; returns nil if empty.
(-queue-shutdown! this)Closes the queue, preventing new offers and waking pending takes/offers.
Closes the queue, preventing new offers and waking pending takes/offers.
(-queue-size this)Returns the current count of buffered elements in the queue.
Returns the current count of buffered elements in the queue.
(-queue-take! this)Takes an item from the queue, parking or blocking until an element is available or queue closed.
Takes an item from the queue, parking or blocking until an element is available or queue closed.
Protocol for thread-safe atomic effect state cells.
Protocol for thread-safe atomic effect state cells.
(-ref-get this)Returns the current value of the Ref.
Returns the current value of the Ref.
(-ref-set! this new-val)Sets the Ref to new-val and returns new-val.
Sets the Ref to `new-val` and returns `new-val`.
(-ref-update! this f)Atomically updates the Ref with f and returns the new value.
Atomically updates the Ref with `f` and returns the new value.
Protocol for counting semaphores controlling concurrent resource access.
Protocol for counting semaphores controlling concurrent resource access.
(-sem-acquire! this)(-sem-acquire! this n)Acquires n permits (default 1), blocking or parking until available.
Acquires `n` permits (default 1), blocking or parking until available.
(-sem-available-permits this)Returns the number of permits currently available.
Returns the number of permits currently available.
(-sem-release! this)(-sem-release! this n)Releases n permits (default 1) back to the semaphore.
Releases `n` permits (default 1) back to the semaphore.
(-sem-try-acquire! this)(-sem-try-acquire! this n)(-sem-try-acquire! this n timeout-ms)Attempts to acquire n permits. Returns true if acquired, false otherwise.
Attempts to acquire `n` permits. Returns true if acquired, false otherwise.
(latch? x)Returns true if x satisfies the ILatch protocol.
Returns true if `x` satisfies the ILatch protocol.
(queue? x)Returns true if x satisfies the IQueue protocol.
Returns true if `x` satisfies the IQueue protocol.
(ref? x)Returns true if x satisfies the IRef protocol.
Returns true if `x` satisfies the IRef protocol.
(semaphore? x)Returns true if x satisfies the ISemaphore protocol.
Returns true if `x` satisfies the ISemaphore protocol.
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 |