event/Loop: round timeout up to avoid unnecessary wakeups

This commit is contained in:
Max Kellermann 2019-12-22 11:58:15 +01:00
parent e3b347820a
commit dcbb9fe07c
2 changed files with 3 additions and 1 deletions

1
NEWS
View File

@ -1,4 +1,5 @@
ver 0.21.18 (not yet released)
* reduce unnecessary CPU wakeups
ver 0.21.17 (2019/12/16)
* protocol

View File

@ -137,7 +137,8 @@ static constexpr int
ExportTimeoutMS(std::chrono::steady_clock::duration timeout)
{
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;
}