diff options
author | Håvard Pettersen <havardpe@oath.com> | 2019-07-01 13:56:28 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2019-07-01 13:56:28 +0000 |
commit | 18384705a5e7426a2c808a37f3c1e216dcb6ebd4 (patch) | |
tree | aaca2134c8b52b40cfe3409370644f51e285ee9b /fnet | |
parent | dd76185fd1639d22393d600a248b18b44ad534aa (diff) |
round -> ceil to avoid premature timeout
in the cases where the timeout is not divisible by the tick size.
Diffstat (limited to 'fnet')
-rw-r--r-- | fnet/src/vespa/fnet/scheduler.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fnet/src/vespa/fnet/scheduler.cpp b/fnet/src/vespa/fnet/scheduler.cpp index 6c8340c1ff8..d9229cd4843 100644 --- a/fnet/src/vespa/fnet/scheduler.cpp +++ b/fnet/src/vespa/fnet/scheduler.cpp @@ -3,6 +3,7 @@ #include "scheduler.h" #include "task.h" #include <sstream> +#include <cmath> #include <vespa/log/log.h> LOG_SETUP(".fnet.scheduler"); @@ -68,7 +69,7 @@ FNET_Scheduler::~FNET_Scheduler() void FNET_Scheduler::Schedule(FNET_Task *task, double seconds) { - uint32_t ticks = 1 + (uint32_t) (seconds * (1000 / SLOT_TICK) + 0.5); + uint32_t ticks = 1 + (uint32_t) std::ceil(seconds * (1000.0 / SLOT_TICK)); std::lock_guard<std::mutex> guard(_lock); if (!task->_killed) { |