pub(crate) struct Handle {
pub(super) name: Option<String>,
pub(super) shared: Shared,
pub(crate) driver: Handle,
pub(crate) blocking_spawner: Spawner,
pub(crate) seed_generator: RngSeedGenerator,
pub(crate) task_hooks: TaskHooks,
pub(crate) timer_flavor: TimerFlavor,
}Expand description
Handle to the multi thread scheduler
Fields§
§name: Option<String>The name of the runtime
Task spawner
driver: HandleResource driver handles
blocking_spawner: SpawnerBlocking pool spawner
seed_generator: RngSeedGeneratorCurrent random number generator seed
task_hooks: TaskHooksUser-supplied hooks to invoke for things
timer_flavor: TimerFlavorTimer flavor used by the runtime
Implementations§
Source§impl Handle
impl Handle
pub(crate) fn num_workers(&self) -> usize
pub(crate) fn num_alive_tasks(&self) -> usize
pub(crate) fn injection_queue_depth(&self) -> usize
pub(crate) fn worker_metrics(&self, worker: usize) -> &WorkerMetrics
Source§impl Handle
impl Handle
Sourcepub(crate) fn spawn<F>(
me: &Arc<Self>,
future: F,
id: Id,
spawned_at: SpawnLocation,
) -> JoinHandle<F::Output> ⓘ
pub(crate) fn spawn<F>( me: &Arc<Self>, future: F, id: Id, spawned_at: SpawnLocation, ) -> JoinHandle<F::Output> ⓘ
Spawns a future onto the thread pool
pub(crate) fn shutdown(&self)
pub(super) fn bind_new_task<T>( me: &Arc<Self>, future: T, id: Id, spawned_at: SpawnLocation, ) -> JoinHandle<T::Output> ⓘ
Source§impl Handle
impl Handle
pub(super) fn schedule_task(&self, task: Notified<Arc<Handle>>, is_yield: bool)
pub(super) fn schedule_option_task_without_yield( &self, task: Option<Notified<Arc<Handle>>>, )
fn schedule_local( &self, core: &mut Core, task: Notified<Arc<Handle>>, is_yield: bool, )
fn next_remote_task(&self) -> Option<Notified<Arc<Handle>>>
fn push_remote_task(&self, task: Notified<Arc<Handle>>)
pub(super) fn close(&self)
Sourcefn notify_parked_local(&self) -> bool
fn notify_parked_local(&self) -> bool
Notify a parked worker.
Returns true if a worker was notified, false otherwise.
fn notify_parked_remote(&self)
pub(super) fn notify_all(&self)
fn notify_if_work_pending(&self)
Sourcefn transition_worker_from_searching(&self) -> bool
fn transition_worker_from_searching(&self) -> bool
Returns true if another parked worker was notified, false otherwise.
Sourcefn shutdown_core(&self, core: Box<Core>)
fn shutdown_core(&self, core: Box<Core>)
Signals that a worker has observed the shutdown signal and has replaced its core back into its handle.
If all workers have reached this point, the final cleanup is performed.
fn ptr_eq(&self, other: &Handle) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Handle
impl !RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl !UnwindSafe for Handle
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