pub struct TimerFd(/* private fields */);Expand description
FD timerfd (cf. timerfd_create(2)).
Implementations§
Source§impl TimerFd
impl TimerFd
Sourcepub const fn from_owned_fd(fd: OwnedFd) -> Self
pub const fn from_owned_fd(fd: OwnedFd) -> Self
Construit depuis un OwnedFd déjà ouvert sur un timerfd.
Sourcepub fn arm(
&self,
spec: &TimerFdSpecification,
flags: TimerSetFlags,
) -> Result<TimerFdSpecification, Errno>
pub fn arm( &self, spec: &TimerFdSpecification, flags: TimerSetFlags, ) -> Result<TimerFdSpecification, Errno>
Arme le timer et retourne l’ancienne spécification.
§Errors
EINVAL: durée hors-plage (dépassementi64lors de la conversion enKernelTimespec), ou combinaison deflagsrefusée par le kernel.EBADF: le FD sous-jacent n’est pas un timerfd valide.
Sourcepub fn disarm(&self) -> Result<TimerFdSpecification, Errno>
pub fn disarm(&self) -> Result<TimerFdSpecification, Errno>
Désarme le timer et retourne l’ancienne spécification.
§Errors
Délègue à TimerFd::arm avec une spécification nulle — seul EBADF
peut survenir. EINVAL ne peut pas survenir ici car la spécification
Duration::ZERO est toujours valide.
Sourcepub fn current(&self) -> Result<TimerFdSpecification, Errno>
pub fn current(&self) -> Result<TimerFdSpecification, Errno>
Lit l’état courant du timer.
§Errors
EBADF: le FD sous-jacent n’est pas un timerfd valide.EINVAL: valeur renvoyée par le kernel hors-plage (ne devrait pas survenir sur un timerfd bien formé).
Sourcepub fn read(&self) -> Result<u64, Errno>
pub fn read(&self) -> Result<u64, Errno>
Lit le nombre d’expirations accumulées.
§Errors
EAGAIN: aucune expiration disponible et le FD a été créé avecTFD_NONBLOCK(cf. testtimerfd_nonblocking_read_without_expiration_returns_eagain).EINTR: interrompu par un signal avant toute expiration. Conforme à la politique EINTR de la couche 0 : l’appelant doit retry explicitement s’il le souhaite.EBADF: le FD sous-jacent n’est pas un timerfd valide.ECANCELED: l’horlogeCLOCK_REALTIME(ouCLOCK_REALTIME_ALARM) a subi un changement discontinu alors que le timer absolu avait été armé avecTFD_TIMER_CANCEL_ON_SET(cf.man 2 timerfd_create).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimerFd
impl RefUnwindSafe for TimerFd
impl Send for TimerFd
impl Sync for TimerFd
impl Unpin for TimerFd
impl UnsafeUnpin 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