Skip to main content

Driver

Struct Driver 

Source
pub(crate) struct Driver {
    io: Driver,
    receiver: UnixStream,
    inner: Arc<()>,
}
Expand description

Responsible for registering wakeups when an OS signal is received, and subsequently dispatching notifications to any signal listeners as appropriate.

Note: this driver relies on having an enabled IO driver in order to listen to pipe write wakeups.

Fields§

§io: Driver

Thread parker. The Driver park implementation delegates to this.

§receiver: UnixStream

A pipe for receiving wake events from the signal handler

§inner: Arc<()>

Shared state. The driver keeps a strong ref and the handle keeps a weak ref. The weak ref is used to check if the driver is still active before trying to register a signal handler.

Implementations§

Source§

impl Driver

Source

pub(crate) fn new(io: Driver, io_handle: &Handle) -> Result<Self>

Creates a new signal Driver instance that delegates wakeups to park.

Source

pub(crate) fn handle(&self) -> Handle

Returns a handle to this event loop which can be sent across threads and can be used as a proxy to the event loop itself.

Source

pub(crate) fn park(&mut self, handle: &Handle)

Source

pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration)

Source

pub(crate) fn shutdown(&mut self, handle: &Handle)

Source

fn process(&mut self)

Trait Implementations§

Source§

impl Debug for Driver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.