diff options
author | Andrii Pohrebniak <andrii.pohrebniak@gmail.com> | 2023-05-18 12:25:39 +0100 |
---|---|---|
committer | Andrii Pohrebniak <andrii.pohrebniak@gmail.com> | 2023-05-20 23:24:11 +0100 |
commit | a4dd9cd1165a1e5cf864c06f634b426d9c88ebc9 (patch) | |
tree | 318c6d2699f79b81b4e823e071ccb56b54b237ee /src/sys/timerfd.rs | |
parent | ae6699940e8fc75008f94312f189892efdcfb2f0 (diff) | |
download | nix-a4dd9cd1165a1e5cf864c06f634b426d9c88ebc9.zip |
timerfd: Add TFD_TIMER_CANCEL_ON_SET flag
Diffstat (limited to 'src/sys/timerfd.rs')
-rw-r--r-- | src/sys/timerfd.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sys/timerfd.rs b/src/sys/timerfd.rs index 90a05a8c..c4337c9d 100644 --- a/src/sys/timerfd.rs +++ b/src/sys/timerfd.rs @@ -135,6 +135,13 @@ impl TimerFd { /// Then the one shot TimeSpec and the delay TimeSpec of the delayed /// interval are going to be interpreted as absolute. /// + /// # Cancel on a clock change + /// + /// If you set a `TFD_TIMER_CANCEL_ON_SET` alongside `TFD_TIMER_ABSTIME` + /// and the clock for this timer is `CLOCK_REALTIME` or `CLOCK_REALTIME_ALARM`, + /// then this timer is marked as cancelable if the real-time clock undergoes + /// a discontinuous change. + /// /// # Disabling alarms /// /// Note: Only one alarm can be set for any given timer. Setting a new alarm @@ -202,6 +209,9 @@ impl TimerFd { /// Note: If the alarm is unset, then you will wait forever. pub fn wait(&self) -> Result<()> { while let Err(e) = read(self.fd.as_fd().as_raw_fd(), &mut [0u8; 8]) { + if e == Errno::ECANCELED { + break; + } if e != Errno::EINTR { return Err(e); } |