event/Loop: round timeout up to avoid unnecessary wakeups
This commit is contained in:
parent
e3b347820a
commit
dcbb9fe07c
1
NEWS
1
NEWS
|
@ -1,4 +1,5 @@
|
||||||
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
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue