From: Waldemar Kozaczuk <
jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <
jwkoz...@gmail.com>
Branch: master
libc: refine how timerfd_* functions handle wall clock jumps
This patch adjusts logic in timerfd::read() to re-arm clock
when clock jumps backwards to the same expiration time point
which is still ahead of us.
Signed-off-by: Waldemar Kozaczuk <
jwkoz...@gmail.com>
---
diff --git a/libc/timerfd.cc b/libc/timerfd.cc
--- a/libc/timerfd.cc
+++ b/libc/timerfd.cc
@@ -205,7 +205,7 @@ int timerfd::read(uio *data, int flags)
ret = 1 + count;
} else {
// Clock is REALTIME and now < _expiration (clock may have jumped backwards)
- _wakeup_due = _expiration + _interval;
+ _wakeup_due = _expiration;
_wakeup_change_cond.wake_one();
goto again;
}