pub struct TimerFd { /* private fields */ }
Implementations§
source§impl TimerFd
impl TimerFd
sourcepub fn new(status: FileStatus) -> Arc<AtomicRefCell<Self>>
pub fn new(status: FileStatus) -> Arc<AtomicRefCell<Self>>
Creates a new TimerFd
object that internally sets up a Timer
that can be waited on
with poll, select, and epoll, enabling support for timerfd_create(2).
We wrap the new TimerFd
in an Arc<AtomicRefCell>
because we need to use a weak
reference to internally support setting up callback functions that reference the TimerFd
on timer expiration.
sourcepub fn get_timer_remaining(&self) -> Option<SimulationTime>
pub fn get_timer_remaining(&self) -> Option<SimulationTime>
Returns the relative duration until the next expiration event occurs if the timer is armed,
and None
if the timer is disarmed.
sourcepub fn get_timer_interval(&self) -> Option<SimulationTime>
pub fn get_timer_interval(&self) -> Option<SimulationTime>
Returns the relative duration over which the timer has been configured to periodically
expire, or None
if the timer is configured to expire only once.
sourcepub fn arm_timer(
&mut self,
host: &Host,
expire_time: EmulatedTime,
interval: Option<SimulationTime>,
cb_queue: &mut CallbackQueue
)
pub fn arm_timer( &mut self, host: &Host, expire_time: EmulatedTime, interval: Option<SimulationTime>, cb_queue: &mut CallbackQueue )
Arm the timer by setting its expiration time and interval, enabling support for
timerfd_settime(2). The readable state of the TimerFd
is updated as appropriate.
sourcepub fn disarm_timer(&mut self, cb_queue: &mut CallbackQueue)
pub fn disarm_timer(&mut self, cb_queue: &mut CallbackQueue)
Disarm the timer so that it no longer fires expiration events, enabling support for
timerfd_settime(2). The readable state of the TimerFd
is updated as appropriate.