pub(crate) struct Handle {
shared: Shared,
pub(crate) driver: Handle,
pub(crate) blocking_spawner: Spawner,
pub(crate) seed_generator: RngSeedGenerator,
pub(crate) task_hooks: TaskHooks,
pub(crate) local_tid: Option<ThreadId>,
}
Expand description
Handle to the current thread scheduler
Fields§
Scheduler state shared across threads
driver: Handle
Resource driver handles
blocking_spawner: Spawner
Blocking pool spawner
seed_generator: RngSeedGenerator
Current random number generator seed
task_hooks: TaskHooks
User-supplied hooks to invoke for things
local_tid: Option<ThreadId>
If this is a LocalRuntime
, flags the owning thread ID.
Implementations§
source§impl Handle
impl Handle
sourcepub(crate) fn spawn<F>(
me: &Arc<Self>,
future: F,
id: Id,
) -> JoinHandle<F::Output> ⓘ
pub(crate) fn spawn<F>( me: &Arc<Self>, future: F, id: Id, ) -> JoinHandle<F::Output> ⓘ
Spawns a future onto the CurrentThread
scheduler
sourcepub(crate) unsafe fn spawn_local<F>(
me: &Arc<Self>,
future: F,
id: Id,
) -> JoinHandle<F::Output> ⓘ
pub(crate) unsafe fn spawn_local<F>( me: &Arc<Self>, future: F, id: Id, ) -> JoinHandle<F::Output> ⓘ
Spawn a task which isn’t safe to send across thread boundaries onto the runtime.
§Safety
This should only be used when this is a LocalRuntime
or in another case where the runtime
provably cannot be driven from or moved to different threads from the one on which the task
is spawned.
fn next_remote_task(&self) -> Option<Notified<Arc<Handle>>>
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_>
pub(crate) fn reset_woken(&self) -> bool
pub(crate) fn num_alive_tasks(&self) -> usize
pub(crate) fn injection_queue_depth(&self) -> usize
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