auralis-task
Scoped async task runtime with cancellation and priority scheduling.
Built on auralis-signal. #![forbid(unsafe_code)]. Single-threaded by design.
Overview
| Type | Role |
|---|---|
TaskScope |
Owns spawned tasks; dropping cancels everything inside (BFS leaf-to-root, no stack overflow) |
Executor |
Single-threaded async executor with high/low priority queues |
Priority |
High or Low — high dequeued first each flush cycle |
CallbackHandle |
RAII guard for signal subscriptions (dropped before tasks on scope cancel) |
set_deferred(sig, val) |
Safe Signal::set from Drop contexts |
yield_now() |
Yield control back to the executor once |
schedule_callback(f) |
Run f at the start of the next flush |
Quick Start
use Signal;
use ;
// Set up the executor
init_flush_scheduler;
// Structured concurrency
let scope = new;
let sig = new;
let s = sig.clone;
scope.spawn;
drop; // cancels all spawned tasks
Feature Flags
| Feature | Enables |
|---|---|
debug |
dump_task_tree() diagnostic snapshot |
ssr-tokio |
init_scope_store_tokio() for multi-request SSR isolation |
Key Properties
- Iterative scope cancellation — BFS collect + leaf-to-root cancel, 200+ nesting levels without stack overflow
- Configurable time budget —
set_global_time_budget(ms), default 8 ms; set tou64::MAXto disable - Panic hook —
set_panic_hook(hook)to observe task failures with task_id and scope_id - Instance isolation —
Executor::new_instance()+with_executor()for multi-threaded SSR
License
Licensed under either of MIT or Apache 2.0 at your option.