Unbuffered channel implementation.
Provides synchronous handoff semantics where:
This matches core.async unbuffered channel behavior.
Unbuffered channel implementation. Provides synchronous handoff semantics where: - put! blocks until a consumer takes the value - take! blocks until a producer offers a value This matches core.async unbuffered channel behavior.
(create)Creates an unbuffered channel with synchronous rendezvous semantics.
DESIGN NOTES
Unlike buffered channels, there is no storage. put! and take! must both be ready at the same time for the operation to complete. This is the classic CSP synchronous handoff model.
When a putter and taker meet, the value is transferred immediately without copying or buffering. Both operations complete atomically.
THREADING
Channel operations block when no matching partner is available. Blocking is implemented via virtual thread parking (see csp-clj.channels.waiters). The channel is safe for concurrent use from multiple virtual threads.
Parameters: None
Returns: UnbufferedChannel instance implementing Channel and Selectable protocols
Example: (def ch (create)) ;; Both operations must rendezvous (future (put! ch :value)) ; blocks until take! (take! ch) ; blocks until put!
See also: csp-clj.channels.waiters for blocking implementation details, csp-clj.channels.buffered for buffered channel alternative
Creates an unbuffered channel with synchronous rendezvous semantics.
DESIGN NOTES
Unlike buffered channels, there is no storage. put! and take! must both
be ready at the same time for the operation to complete. This is the
classic CSP synchronous handoff model.
When a putter and taker meet, the value is transferred immediately
without copying or buffering. Both operations complete atomically.
THREADING
Channel operations block when no matching partner is available.
Blocking is implemented via virtual thread parking (see csp-clj.channels.waiters).
The channel is safe for concurrent use from multiple virtual threads.
Parameters:
None
Returns:
UnbufferedChannel instance implementing Channel and Selectable protocols
Example:
(def ch (create))
;; Both operations must rendezvous
(future (put! ch :value)) ; blocks until take!
(take! ch) ; blocks until put!
See also: csp-clj.channels.waiters for blocking implementation details,
csp-clj.channels.buffered for buffered channel alternativecljdoc 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 |