Skip to main content

DelayedTaskSchedulerInner

Struct DelayedTaskSchedulerInner 

Source
pub struct DelayedTaskSchedulerInner {
    pub state: Monitor<DelayedTaskSchedulerState>,
    pub queued_task_count: AtomicUsize,
    pub running_task_count: AtomicUsize,
    pub completed_task_count: AtomicUsize,
    pub cancelled_task_count: AtomicUsize,
}
Expand description

Shared delayed scheduler state.

Fields§

§state: Monitor<DelayedTaskSchedulerState>

Mutable lifecycle and heap state.

§queued_task_count: AtomicUsize

Number of tasks still pending in the delay heap.

§running_task_count: AtomicUsize

Number of tasks currently executing on the scheduler thread.

§completed_task_count: AtomicUsize

Number of tasks that ran to completion.

§cancelled_task_count: AtomicUsize

Number of delayed tasks cancelled before execution.

Implementations§

Source§

impl DelayedTaskSchedulerInner

Source

pub fn new() -> Self

Creates an empty delayed scheduler.

§Returns

Shared scheduler state before its worker thread starts.

Source

pub fn queued_count(&self) -> usize

Returns the queued delayed task count.

§Returns

Number of tasks that have not started or been cancelled.

Source

pub fn running_count(&self) -> usize

Returns the currently running task count.

§Returns

1 when the scheduler thread is running a task, otherwise 0.

Source

pub fn finish_queued_cancellation(&self)

Records a pending task cancellation.

Source

pub fn cancel_task_state(&self, task_state: &AtomicU8) -> bool

Attempts to cancel a task state before it starts.

§Parameters
  • task_state - Shared task lifecycle state.
§Returns

true if this call cancelled the task.

Source

pub fn start_task_state(&self, task_state: &AtomicU8) -> bool

Marks a task as started if it has not been cancelled.

§Parameters
  • task_state - Shared task lifecycle state.
§Returns

true if the task may execute.

Source

pub fn shutdown(&self)

Requests graceful shutdown.

Source

pub fn stop(&self) -> StopReport

Requests immediate shutdown and cancels all queued delayed tasks.

§Returns

Count-based shutdown report.

Source

pub fn is_not_running(&self) -> bool

Returns whether shutdown has started.

§Returns

true if new delayed tasks are rejected.

Source

pub fn lifecycle(&self) -> ExecutorServiceLifecycle

Returns the current lifecycle state.

§Returns

ExecutorServiceLifecycle::Terminated after the worker has exited, otherwise the stored lifecycle state.

Source

pub fn is_terminated(&self) -> bool

Returns whether the scheduler thread has exited.

§Returns

true after shutdown and scheduler termination.

Source

pub fn wait_for_termination(&self)

Waits until the scheduler thread exits.

Source

pub fn terminate(&self, state: &mut DelayedTaskSchedulerState)

Marks the scheduler thread as terminated.

Trait Implementations§

Source§

impl Default for DelayedTaskSchedulerInner

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DropFlavorWrapper<T> for T

Source§

type Flavor = MayDrop

The DropFlavor that wraps T into Self
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResult<T> for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.