Guard against busy spinning in HashedWheelTimer when using windows and a tickDuration of 1 (#9714)

Motivation:

We do not correct guard against the gact that when applying our workaround for windows we may end up with a 0 sleep period. In this case we should just sleep for 1 ms.

Modifications:

Guard agains the case when our calculation will produce 0 as sleep time on windows

Result:

Fixes https://github.com/netty/netty/issues/9710.
This commit is contained in:
Norman Maurer 2019-10-25 11:14:06 -07:00
parent 5949e193ce
commit 68413574aa

View File

@ -563,6 +563,9 @@ public class HashedWheelTimer implements Timer {
// See https://github.com/netty/netty/issues/356
if (PlatformDependent.isWindows()) {
sleepTimeMs = sleepTimeMs / 10 * 10;
if (sleepTimeMs == 0) {
sleepTimeMs = 1;
}
}
try {