Expand description
Typed MPMC blocking channel for IPC between kernel tasks and silos.
§Two levels of abstraction
§1. Typed MPMC channel — kernel-internal
channel<T>(capacity) returns a (Sender<T>, Receiver<T>) pair.
Both endpoints are cloneable (Multi-Producer / Multi-Consumer).
When the last Sender is dropped, all waiting Receivers see
Err(ChannelError::Disconnected), and vice-versa.
let (tx, rx) = channel::<u64>(8);
let tx2 = tx.clone(); // second producer
let rx2 = rx.clone(); // second consumer§2. Symmetric channel — userspace IPC (silo-to-silo)
SyncChan is a symmetric IpcMessage channel: any holder can send
or receive. It is stored by ChanId in a global registry and
accessed from userspace via SYS_CHAN_* syscalls. Destroyed explicitly
via SyncChan::destroy when all userspace handles are closed.
§Blocking guarantee
Both levels use WaitQueue::wait_until — the condition closure is
evaluated atomically under the waiter lock, eliminating the classic
lost-wakeup race without a polling loop.
§Lock ordering
To avoid deadlock:
- The
queue(buffer) lock is always acquired inside thewait_untilclosure, and released beforewake_one()is called. send_waitq.wake_one()is called outside any recv closure.recv_waitq.wake_one()is called outside any send closure.
Structs§
- ChanId
- Unique identifier for a
SyncChanin the global registry. - Receiver
- The receive end of a
channel. - Sender
- The send end of a
channel. - Sync
Chan - A symmetric bounded channel over
IpcMessage, used by the global channel registry for silo-to-silo syscall-level IPC.
Enums§
Functions§
- channel
- Create a new bounded MPMC channel with the given
capacity. - create_
channel - Create a new
SyncChanwith the given capacity and register it. - destroy_
channel - Destroy a channel: remove it from the registry and wake all waiters.
- get_
channel - Look up a channel by ID. Returns a cloned
Arc<SyncChan>if found.