Commit dcbb9fe0 authored by Max Kellermann's avatar Max Kellermann

event/Loop: round timeout up to avoid unnecessary wakeups

parent e3b34782
ver 0.21.18 (not yet released) ver 0.21.18 (not yet released)
* reduce unnecessary CPU wakeups
ver 0.21.17 (2019/12/16) ver 0.21.17 (2019/12/16)
* protocol * protocol
......
...@@ -137,7 +137,8 @@ static constexpr int ...@@ -137,7 +137,8 @@ static constexpr int
ExportTimeoutMS(std::chrono::steady_clock::duration timeout) ExportTimeoutMS(std::chrono::steady_clock::duration timeout)
{ {
return timeout >= timeout.zero() return timeout >= timeout.zero()
? int(std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()) /* round up (+1) to avoid unnecessary wakeups */
? int(std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()) + 1
: -1; : -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment