Module channel

Module channel 

Source
Expand description

Channel operations for CSP-style concurrency

Channels are the primary communication mechanism between strands. They use May’s mpsc channels with cooperative blocking.

§Non-Blocking Guarantee

All channel operations (send, receive) cooperatively block using May’s scheduler. They NEVER block OS threads - May handles scheduling other strands while waiting.

§Error Handling

Two variants are available for send/receive:

  • send / receive - Panic on errors (closed channel, invalid ID)
  • send-safe / receive-safe - Return success flag instead of panicking

The safe variants enable graceful shutdown patterns:

value channel-id send-safe if
  # sent successfully
else
  # channel closed, handle gracefully
then

Re-exports§

pub use patch_seq_chan_receive as receive;
pub use patch_seq_chan_receive_safe as receive_safe;
pub use patch_seq_chan_send as send;
pub use patch_seq_chan_send_safe as send_safe;
pub use patch_seq_close_channel as close_channel;
pub use patch_seq_make_channel as make_channel;

Structs§

ChannelStats
Per-channel statistics for diagnostics

Functions§

channel_count
Get the number of open channels (for diagnostics)
channel_stats
Get per-channel statistics for all open channels (for diagnostics)
patch_seq_chan_receive
Receive a value from a channel
patch_seq_chan_receive_safe
Receive a value from a channel, with error handling
patch_seq_chan_send
Send a value through a channel
patch_seq_chan_send_safe
Send a value through a channel, with error handling
patch_seq_close_channel
Close a channel and remove it from the registry
patch_seq_make_channel
Create a new channel