pub struct TimerFd(/* private fields */);
Expand description
Represents a timerfd.
See also timerfd_create(2)
.
Implementations§
Source§impl TimerFd
impl TimerFd
Sourcepub fn new_custom(
clock: ClockId,
nonblocking: bool,
cloexec: bool,
) -> IoResult<TimerFd>
pub fn new_custom( clock: ClockId, nonblocking: bool, cloexec: bool, ) -> IoResult<TimerFd>
Creates a new TimerFd
.
By default, it uses the monotonic clock, is blocking and does not close on exec. The parameters allow you to change that.
§Errors
On Linux 2.6.26 and earlier, nonblocking and cloexec are not supported and setting them
will return an error of kind ErrorKind::InvalidInput
.
This can also fail in various cases of resource exhaustion. Please check
timerfd_create(2)
for details.
Sourcepub fn new() -> IoResult<TimerFd>
pub fn new() -> IoResult<TimerFd>
Creates a new TimerFd
with default settings.
Use new_custom
to specify custom settings.
Sourcepub fn set_state(
&mut self,
state: TimerState,
sflags: SetTimeFlags,
) -> TimerState
pub fn set_state( &mut self, state: TimerState, sflags: SetTimeFlags, ) -> TimerState
Sets this timerfd to a given TimerState
and returns the old state.
Sourcepub fn get_state(&self) -> TimerState
pub fn get_state(&self) -> TimerState
Returns the current TimerState
.
Trait Implementations§
Source§impl AsFd for TimerFd
impl AsFd for TimerFd
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
Auto Trait Implementations§
impl Freeze for TimerFd
impl RefUnwindSafe for TimerFd
impl Send for TimerFd
impl Sync for TimerFd
impl Unpin for TimerFd
impl UnwindSafe for TimerFd
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