Skip to main content

WeightedRuntime

Type Alias WeightedRuntime 

pub type WeightedRuntime = ConfiguredRuntime<ConcurrentMode, ManualClock, DefaultIdlePolicy, NoHooks, WeightedSerialParQueue>;
Expand description

多线程提交、单线程推进的权重运行时(single-threaded weighted runtime)。

使用权重队列(weighted queue)作为外部任务队列,绑定独占 TaskQueue, 默认提供定时任务队列(timer task queue)和空闲任务队列(idle task queue)。 创建后由所属线程(owner thread)推进。共享句柄(shared handle)可跨线程派发。 普通派发使用并行中档;需要串行队列或其它档位时用 spawn_with_queue。 wasm32 目标不导出本类型。浏览器(browser)可使用 ConcurrentRuntime 的单轮推进。

关闭永久停收并清理任务,原生池分配保留到进程退出。报告指出这项限制, 关闭查询为 Closed / Requested。每次构造都会产生一份原生池分配。

Aliased Type§

pub struct WeightedRuntime { /* private fields */ }

Implementations§

§

impl WeightedRuntime

pub fn new_weighted() -> Result<Self>

使用默认选项构造,应用须先安装原全局时钟(global clock)。

pub fn with_weighted_options(options: RuntimeOptions) -> Result<Self>

使用指定运行时选项及固定队列。默认 MPSC 的外部队列选项不适用。