summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-12-22 11:58:15 +0100
committerMax Kellermann <max@musicpd.org>2019-12-22 11:58:31 +0100
commitdcbb9fe07ce0c48ffaf6300167eb74276d129136 (patch)
treec8c82d15e15073ecc2ed8b0d40b12a3725e6f9db /src
parente3b347820aef0bd495eb37df3e1d6caa4f5c10de (diff)
event/Loop: round timeout up to avoid unnecessary wakeups
Diffstat (limited to 'src')
-rw-r--r--src/event/Loop.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx
index 644cacc39..d3de427c9 100644
--- a/src/event/Loop.cxx
+++ b/src/event/Loop.cxx
@@ -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;
}