Liking cljdoc? Tell your friends :D
Clojure only.

csp-clj.channels.buffered

Buffered channel implementation.

Provides asynchronous queue semantics where:

  • put! blocks only when buffer is full
  • take! blocks only when buffer is empty
  • Items are queued in FIFO order

Capacity is always at least 1.

Buffered channel implementation.

Provides asynchronous queue semantics where:
- put! blocks only when buffer is full
- take! blocks only when buffer is empty
- Items are queued in FIFO order

Capacity is always at least 1.
raw docstring

createclj

(create)
(create buffer-or-capacity)

Creates a buffered channel with the specified buffer.

The buffer argument can be either:

  • A number (capacity), which creates a FixedBuffer
  • A Buffer instance implementing csp-clj.protocols.buffer/Buffer

DESIGN NOTES

Capacity is always >= 1. A buffered channel with capacity 1 behaves similarly to an unbuffered channel for single operations, but allows pipelining (producer can put next value while consumer processes current).

THREADING

Channel operations may block when the buffer is full (put!) or empty (take!). Blocking is implemented via virtual thread parking (see csp-clj.channels.waiters). The channel is safe for concurrent use from multiple virtual threads.

Parameters:

  • buffer-or-capacity: Buffer instance or positive integer

Returns: BufferedChannel instance implementing Channel and Selectable protocols

Example: (create 10) ; buffered with capacity 10 (create (fixed-buffer 5)) ; with explicit buffer

See also: csp-clj.channels.waiters for blocking implementation details

Creates a buffered channel with the specified buffer.

The buffer argument can be either:
- A number (capacity), which creates a FixedBuffer
- A Buffer instance implementing csp-clj.protocols.buffer/Buffer

DESIGN NOTES

Capacity is always >= 1. A buffered channel with capacity 1 behaves
similarly to an unbuffered channel for single operations, but allows
pipelining (producer can put next value while consumer processes current).

THREADING

Channel operations may block when the buffer is full (put!) or empty (take!).
Blocking is implemented via virtual thread parking (see csp-clj.channels.waiters).
The channel is safe for concurrent use from multiple virtual threads.

Parameters:
  - buffer-or-capacity: Buffer instance or positive integer

Returns:
  BufferedChannel instance implementing Channel and Selectable protocols

Example:
  (create 10)           ; buffered with capacity 10
  (create (fixed-buffer 5)) ; with explicit buffer

See also: csp-clj.channels.waiters for blocking implementation details
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