[][src]Struct mio_timerfd::TimerFd

pub struct TimerFd { /* fields omitted */ }

A timerfd which can be used to create mio-compatible timers on linux targets.

Methods

impl TimerFd[src]

pub fn new(clockid: ClockId) -> Result<Self>[src]

Create a new timerfd using the given clock; if you're not sure what clock to use read timerfd(7) for more details, or know that ClockId::Monotonic is a good default for most programs.

pub fn set_timeout(&mut self, timeout: &Duration) -> Result<()>[src]

Set a single timeout to occur after the specified duration.

pub fn set_timeout_interval(&mut self, timeout: &Duration) -> Result<()>[src]

Set a timeout to occur at each interval of the specified duration from this point in time forward.

pub fn disarm(&mut self) -> Result<()>[src]

Unset any existing timeouts on the timer, making this timerfd inert until rearmed.

pub fn read(&self) -> Result<u64>[src]

Read the timerfd to reset the readability of the timerfd, and allow determining how many times the timer has elapsed since the last read. This should usually be read after any wakeups caused by this timerfd, as reading the timerfd is important to reset the readability of the timerfd.

Failing to call this after this timerfd causes a wakeup will result in immediately re-waking on this timerfd if level polling, or never re-waking if edge polling.

pub fn create(clockid: c_int, flags: c_int) -> Result<Self>[src]

Wrapper of timerfd_create from timerfd_create(7); For most users it's probably easier to use the TimerFd::new.

Note that this library may cause the thread to block when TimerFd::read is called if the TFD_NONBLOCK flag is not included in the flags.

pub fn settime(
    &mut self,
    flags: c_int,
    new_value: &itimerspec
) -> Result<itimerspec>
[src]

Wrapper of timerfd_settime from timerfd_create(7); For most users it's probably easier to use the TimerFd::set_timeout or the TimerFd::set_timeout_interval functions.

pub fn gettime(&self) -> Result<itimerspec>[src]

Wrapper of timerfd_gettime from timerfd_create(7)

Trait Implementations

impl AsRawFd for TimerFd[src]

impl Drop for TimerFd[src]

impl Source for TimerFd[src]

Auto Trait Implementations

impl RefUnwindSafe for TimerFd

impl Send for TimerFd

impl Sync for TimerFd

impl Unpin for TimerFd

impl UnwindSafe for TimerFd

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.