Ticked Async Executor
Async Local Executor which executes woken tasks only when it is ticked
Usage
Default Local Executor
use *;
const DELTA: f64 = 1000.0 / 60.0;
let executor = default;
executor.spawn_local.detach;
// Tick your executor to run the tasks
assert_eq!;
executor.tick;
assert_eq!;
Split Local Executor
use *;
const DELTA: f64 = 1000.0 / 60.0;
let = default;
spawner.spawn_local.detach;
// Tick your ticker to run the tasks
assert_eq!;
ticker.tick;
assert_eq!;
Limit the number of woken tasks run per tick
use *;
const DELTA: f64 = 1000.0 / 60.0;
let executor = default;
executor.spawn_local.detach;
executor.spawn_local.detach;
// Runs upto 1 woken tasks per tick
assert_eq!;
executor.tick;
assert_eq!;
executor.tick;
assert_eq!;
Caveats
- Uses the
smolecosystem - Ensure that tasks are spawned on the same thread as the one that initializes the executor
Roadmap
- TickedAsyncExecutor
- SplitTickedAsyncExecutor
- Similar to the channel API, but spawner and ticker cannot be moved to different threads
- Tracing