Expand description
Sparreal OS Async Runtime
Single CPU async executor based on embassy design, providing tokio-like API experience.
§Features
- Single CPU async task execution
- Wake task priority scheduling
- Timeout task priority promotion (default 1 second)
- Interrupt safe (using IrqSpinlock)
- Dynamic memory allocation (alloc)
§Usage Examples
use sparreal_kernel::os::async::{spawn, block_on, tick};
// Spawn async task
let handle = spawn(async {
// Async task code
println!("Hello from async task!");
});
// Block until task completes
block_on(async {
// Your async code
});
// Manual scheduling (in event loop)
loop {
tick(); // Process one task scheduling
// Other main loop logic...
}Re-exports§
pub use executor::SingleCpuExecutor;pub use executor::block_on;pub use executor::has_pending_tasks;pub use executor::spawn;pub use executor::task_count;pub use executor::tick;pub use task::TaskHandle;pub use task::TaskId;pub use task::TaskState;