Struct RuntimeQueues
pub struct RuntimeQueues<C: ExecutorClock<Instant = GlobalManualInstant> = ManualClock, E = MpscTaskQueue, I = MpscIdleTaskQueue, F = MakeDefaultTimer<C>, B = DefaultInternalQueue> { /* private fields */ }Expand description
分别选择外部任务队列(external task queue)、内部任务队列(internal task queue)、 定时任务队列(timer task queue)和空闲任务队列(idle task queue)。 缺项使用默认配置。定时和空闲可分别省略。构造运行时(runtime)时移交原实例, 由执行器(executor)绑定。独立串行运行时只接受原外部与内部组合。
Implementations§
§impl<C: ExecutorClock<Instant = GlobalManualInstant>, E, I, F, B> RuntimeQueues<C, E, I, F, B>
impl<C: ExecutorClock<Instant = GlobalManualInstant>, E, I, F, B> RuntimeQueues<C, E, I, F, B>
pub fn with_external<Q: ExternalQueueManager>(
self,
queue: Q,
) -> RuntimeQueues<C, Q, I, F, B>
pub fn with_external<Q: ExternalQueueManager>( self, queue: Q, ) -> RuntimeQueues<C, Q, I, F, B>
移交外部任务队列(external task queue)的管理者。已有共享访问按队列原约定使用。 经运行时(runtime)派发时由运行时核对任务归属并安排通知(notification)。
pub fn with_idle<Q: IdleQueueManager>(
self,
queue: Q,
) -> RuntimeQueues<C, E, Q, F, B>
pub fn with_idle<Q: IdleQueueManager>( self, queue: Q, ) -> RuntimeQueues<C, E, Q, F, B>
移交空闲任务队列(idle task queue)的管理者。空闲判定仍由原执行器(executor)负责。 已有共享访问按队列原约定使用,经运行时派发时由运行时负责归属和通知(notification)。
pub fn with_internal<Q>(
self,
queue: Q,
) -> RuntimeQueues<C, E, I, F, impl RuntimeInternalFactory<Q>>where
Q: InternalTaskQueue + 'static,
pub fn with_internal<Q>(
self,
queue: Q,
) -> RuntimeQueues<C, E, I, F, impl RuntimeInternalFactory<Q>>where
Q: InternalTaskQueue + 'static,
按值移交内部任务队列(internal task queue)。
运行时构造只接管此原值,要求队列开放、为空且仅绑定当前执行器(executor)。 已绑定另一所属域(owner domain)的队列无法接入。选择已移交,构造失败时沿原释放约定。
pub fn with_internal_factory<Q, G>(
self,
make: G,
) -> RuntimeQueues<C, E, I, F, G>where
Q: InternalTaskQueue + 'static,
G: for<'owner> FnOnce(InternalQueueContext<'owner>) -> Result<Q>,
pub fn with_internal_factory<Q, G>(
self,
make: G,
) -> RuntimeQueues<C, E, I, F, G>where
Q: InternalTaskQueue + 'static,
G: for<'owner> FnOnce(InternalQueueContext<'owner>) -> Result<Q>,
在实际所属域(owner domain)建立后调用一次回调(callback),接管回调交出的队列。
回调持有的构造权限仅在本次调用中有效。独立串行的队列类型检查早于回调。 执行器(executor)检查实际队列后才建立定时来源,并沿原约定接管构造和关闭责任。
pub fn without_idle(self) -> RuntimeQueues<C, E, NoIdleQueue, F, B>
pub fn without_idle(self) -> RuntimeQueues<C, E, NoIdleQueue, F, B>
省略空闲任务队列(idle task queue),相应派发入口在编译期不可用。 已指定的空闲管理者在调用线程释放,其余选择保留。
pub fn without_timer(
self,
) -> RuntimeQueues<C, E, I, NoTimerQueue<GlobalManualInstant>, B>
pub fn without_timer( self, ) -> RuntimeQueues<C, E, I, NoTimerQueue<GlobalManualInstant>, B>
省略定时任务队列(timer task queue),相应计时、带超时等待和定时派发入口不可用。 默认构造无需安装全局时钟(clock)。原定时构造回调及其捕获值在调用线程释放, 回调不执行,其余选择保留。
pub fn with_timer<T, G>(
self,
make: G,
) -> RuntimeQueues<C, E, I, impl FnOnce(RuntimeId, &C, ThreadNotifier, CancelTimerOptions) -> Result<T>, B>where
T: ExecutorTimer<Instant = GlobalManualInstant> + 'static,
G: FnOnce(RuntimeId, &C, ThreadNotifier) -> Result<T>,
pub fn with_timer<T, G>(
self,
make: G,
) -> RuntimeQueues<C, E, I, impl FnOnce(RuntimeId, &C, ThreadNotifier, CancelTimerOptions) -> Result<T>, B>where
T: ExecutorTimer<Instant = GlobalManualInstant> + 'static,
G: FnOnce(RuntimeId, &C, ThreadNotifier) -> Result<T>,
使用一次原计时构造回调准备所选实例。回调使用本次实际身份、时钟(clock)和通知状态。 回调返回的拥有者在创建线程(thread)交给原执行器。失败时保留原报告(Report)。