Trait tokio::runtime::task::Schedule

source ·
pub(crate) trait Schedule: Sync + Sized + 'static {
    // Required methods
    fn release(&self, task: &Task<Self>) -> Option<Task<Self>>;
    fn schedule(&self, task: Notified<Self>);
    fn hooks(&self) -> TaskHarnessScheduleHooks;

    // Provided methods
    fn yield_now(&self, task: Notified<Self>) { ... }
    fn unhandled_panic(&self) { ... }
}

Required Methods§

source

fn release(&self, task: &Task<Self>) -> Option<Task<Self>>

The task has completed work and is ready to be released. The scheduler should release it immediately and return it. The task module will batch the ref-dec with setting other options.

If the scheduler has already released the task, then None is returned.

source

fn schedule(&self, task: Notified<Self>)

Schedule the task

source

fn hooks(&self) -> TaskHarnessScheduleHooks

Provided Methods§

source

fn yield_now(&self, task: Notified<Self>)

Schedule the task to run in the near future, yielding the thread to other tasks.

source

fn unhandled_panic(&self)

Polling the task resulted in a panic. Should the runtime shutdown?

Object Safety§

This trait is not object safe.

Implementors§