pub async fn run_async_event_loop<P, D>(
platform: &mut P,
engine: &mut VeloxEngine,
driver: &D,
config: AsyncLoopConfig,
) -> AsyncLoopReportwhere
P: AsyncPlatform,
D: AsyncDriver,Expand description
跨调度器、全平台通用的异步主循环驱动函数。
统一协调 AsyncPlatform、VeloxEngine 与可插拔 AsyncDriver:
- 使用
SchedulerClock::now_ms自动计算真实增量dt_ms(钳位至1..=100ms); - 异步调用
platform.step_platform_async(engine, dt_ms).await; - 返回
Poll时按剩余帧预算driver.sleep(...).await或driver.yield_now().await; - 返回
Wait且无新增脏状态时,挂起在driver.wait_for_event().await进入 0% CPU 休眠; - 返回
Exit或达到config.max_steps时干净退出并返回AsyncLoopReport。