Expand description
Scheduler - Green Thread Management with May
CSP-style concurrency for Seq using May coroutines. Each strand is a lightweight green thread that can communicate via channels.
§Non-Blocking Guarantee
Channel operations (send, receive) use May’s cooperative blocking and NEVER
block OS threads. However, I/O operations (write_line, read_line in io.rs)
currently use blocking syscalls. Future work will make all I/O non-blocking.
§Panic Behavior
Functions panic on invalid input (null stacks, negative IDs, closed channels). In a production system, consider implementing error channels or Result-based error handling instead of panicking.
Re-exports§
pub use patch_seq_scheduler_init as scheduler_init;pub use patch_seq_scheduler_run as scheduler_run;pub use patch_seq_scheduler_shutdown as scheduler_shutdown;pub use patch_seq_spawn_strand as spawn_strand;pub use patch_seq_strand_spawn as strand_spawn;pub use patch_seq_wait_all_strands as wait_all_strands;pub use patch_seq_yield_strand as yield_strand;
Structs§
- Strand
Registry - Lock-free strand registry
- Strand
Slot - A slot in the strand registry
Statics§
Functions§
- patch_
seq_ ⚠scheduler_ init - Initialize the scheduler
- patch_
seq_ ⚠scheduler_ run - Run the scheduler and wait for all coroutines to complete
- patch_
seq_ ⚠scheduler_ shutdown - Shutdown the scheduler
- patch_
seq_ ⚠spawn_ strand - Legacy spawn_strand function (kept for compatibility)
- patch_
seq_ ⚠strand_ spawn - Spawn a strand (coroutine) with initial stack
- patch_
seq_ ⚠wait_ all_ strands - Wait for all strands to complete
- patch_
seq_ ⚠yield_ strand - Yield execution to allow other coroutines to run
- strand_
registry - Get or initialize the global strand registry