Skip to content
Beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

11.3 Channels preview

Move data between fibers with Channel send and receive—not shared mutable stacks.

Channels preview

If two fibers need to talk, they use a channel. They do not share a mutable stack and hope for the best—that pattern already has a body count in other languages.

  • Channel<T> carries typed messages between fibers.
  • Send / Receive operations block cooperatively (scheduler-aware).
  • Errors and cancellation surface through Result on join/receive paths per Concurrency package.
flowchart LR
  f1[Fiber A]
  f2[Fiber B]
  ch[Channel T]
  f1 -->|Send| ch
  ch -->|Receive| f2

Cross-fiber events use channels, not ad-hoc flags—see ADR: cross-fiber events use channels.

Mutex and WaitGroup coordinate invariants—they are not a substitute for channel payload transfer. If you are passing data, use a channel; if you are guarding a critical section, use the primitives the spec names.

Shared heap objects still follow Memory and references—channels are how you avoid data races without pretending Beskid is C++.

Corelib concurrency