diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2019-01-22 17:06:51 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-01-22 17:06:51 +0300 |
commit | 4c50dc94c38cca718a7dc8a4f1dd6f2e5b1c4cfb (patch) | |
tree | f045e9c075888533cc5e62eb92a020e833f3ce94 /winsup/cygwin/timerfd.cc | |
parent | a75bd958b4a64182645984babedad3c2babb8401 (diff) |
Cygwin: timerfd: another overrun computation fix and drop useless variable
- When correcting the next expiration timestamp, the number of
expirations gets computed correctly, just the expiration timestamp
itself is then only incremented by a single interval, rather than
the just computed expired intervals. Fix that.
- drop the local clock variable in timerfd_tracker::create. It doesn't
serve any purpose.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/timerfd.cc')
-rw-r--r-- | winsup/cygwin/timerfd.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc index e865c0c15..87074fd6f 100644 --- a/winsup/cygwin/timerfd.cc +++ b/winsup/cygwin/timerfd.cc @@ -163,9 +163,9 @@ timerfd_tracker::thread_func () bigger than "now" and fix expiration count as required */ while (ts <= (now = get_clock_now ())) { - increment_expiration_count ((now - ts + get_interval () - 1) - / get_interval ()); - ts += get_interval (); + exp_cnt = (now - ts + get_interval () - 1) / get_interval (); + increment_expiration_count (exp_cnt); + ts += get_interval () * exp_cnt; } set_exp_ts (ts); /* NtSetTimer allows periods of up to 24 days only. If the time @@ -271,7 +271,6 @@ int timerfd_tracker::create (clockid_t clock_id) { int ret; - clk_t *clock; NTSTATUS status; OBJECT_ATTRIBUTES attr; @@ -281,8 +280,7 @@ timerfd_tracker::create (clockid_t clock_id) LARGE_INTEGER sectionsize = { QuadPart: PAGE_SIZE }; /* Valid clock? */ - clock = get_clock (clock_id); - if (!clock) + if (!get_clock (clock_id)) { ret = -EINVAL; goto err; |