[COMMIT osv master] libc: refine how timerfd_* functions handle wall clock jumps

5 views
Skip to first unread message

Commit Bot

unread,
Mar 15, 2020, 3:58:01 PM3/15/20
to osv...@googlegroups.com, Waldemar Kozaczuk
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;
}
Reply all
Reply to author
Forward
0 new messages