pub struct ExecutorLocal<T: ExecutorTimer + 'static> { /* private fields */ }Expand description
本地设施(local facilities)的弱访问目标;不实现Send/Sync,不能跨线程借入。 公开给框架实现者用于静态接入,不向最终运行时(runtime)用户导出其实例。 释放(drop)时在原所属线程(owner thread)完成实际退出,仍在进行的同步活动可延迟最终释放。 原任务域与来源沿自身约定清理,首次恐慌(panic)继续传播;不可把关闭请求当成功确认。
Implementations§
Source§impl<T: ExecutorTimer + 'static> ExecutorLocal<T>
impl<T: ExecutorTimer + 'static> ExecutorLocal<T>
pub fn runtime_id(&self) -> RuntimeId
Sourcepub fn with_owner<R>(&self, action: impl FnOnce(&TaskThread) -> R) -> Result<R>
pub fn with_owner<R>(&self, action: impl FnOnce(&TaskThread) -> R) -> Result<R>
同步框架访问;不允许返回owner借用。只读Ref可跨本次调用,不持其它队列借用。
Sourcepub fn try_push(
&self,
task: Runnable,
front: bool,
) -> RawResult<(), QueuePushError>
pub fn try_push( &self, task: Runnable, front: bool, ) -> RawResult<(), QueuePushError>
原线程尾插/头插,尚未接纳的create_local可排队;不在此poll或提前admit。 正常新入队用同一ExecutorState记数,拒绝返还原值。
Sourcepub fn try_push_timer(
&self,
deadline: T::Instant,
item: T::Item,
) -> RawResult<T::Key, TimerSubmitError<T::Item>>
pub fn try_push_timer( &self, deadline: T::Instant, item: T::Item, ) -> RawResult<T::Key, TimerSubmitError<T::Item>>
同源定时本地提交;不为Item添加Send/Sync,不刷新时钟。
Trait Implementations§
Source§impl<T: ExecutorTimer + 'static> Drop for ExecutorLocal<T>
impl<T: ExecutorTimer + 'static> Drop for ExecutorLocal<T>
Auto Trait Implementations§
impl<T> !Freeze for ExecutorLocal<T>
impl<T> !RefUnwindSafe for ExecutorLocal<T>
impl<T> !Send for ExecutorLocal<T>
impl<T> !Sync for ExecutorLocal<T>
impl<T> !UnwindSafe for ExecutorLocal<T>
impl<T> Forget for ExecutorLocal<T>
impl<T> Move for ExecutorLocal<T>
impl<T> Unpin for ExecutorLocal<T>
impl<T> UnsafeUnpin for ExecutorLocal<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more