pub struct TimerPoll(/* private fields */);Expand description
A main instance which initializes the event listeners from the registered timers.
Implementations§
Source§impl TimerPoll
impl TimerPoll
Sourcepub fn new() -> TimerResult<Self>
pub fn new() -> TimerResult<Self>
Creates new instance of the event listener.
Sourcepub fn add<T: FdTimerMarker>(&self, timer: T) -> TimerResult<PolledTimerFd<T>>
pub fn add<T: FdTimerMarker>(&self, timer: T) -> TimerResult<PolledTimerFd<T>>
Adds the timer to the event monitor. It accepts any reference to instance which implements AsFd and it is not limited specificly to timers. Maybe later this behaviour will me modified.
§Arguments
timer-Twhere impl [AsTimerFd] a timer instance. The provided FD will be polled for [EpollFlags::EPOLLIN] event types. The FD of the timer should be inited as non-blocking, but if it is not, the function attepts to switch the mode. It will not be restored when the timer will be removed fromSelf.
§Returns
A TimerResult i.e Result is returned with error description in case of error.
Sourcepub fn poll(
&self,
timeout: Option<i32>,
) -> TimerResult<Option<Vec<PollEventType>>>
pub fn poll( &self, timeout: Option<i32>, ) -> TimerResult<Option<Vec<PollEventType>>>
Polls the event monitor for events. Depending on the timeout the behaviour will
be different.
§Arguments
timeout- poll timeout. If set to Option::None will block the current thread. If set to Option::Some with inner value0will return immidiatly. The timeout is set inmiliseconds.
§Returns
A TimerResult i.e Result is returned with
-
Result::Ok with the Option where:
-
Option::Some with the Vec with the RawFd of the timer’s where the event has happened.
-
Option::None if no events happened.
-
-
Result::Err with error description.
pub fn get_poll_interruptor(&self) -> PollInterrupt
pub fn interrupt_poll(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimerPoll
impl RefUnwindSafe for TimerPoll
impl Send for TimerPoll
impl Sync for TimerPoll
impl Unpin for TimerPoll
impl UnwindSafe for TimerPoll
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