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 committed by GitHub
parent 7961c84199
commit efce8e5363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -571,6 +571,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 {