Java Thread.sleep() on Windows 10 stops in S3 sleep status

前端 未结 2 1817
一向
一向 2021-01-04 06:34

There\'s a desktop application that uses Thread.sleep() to achieve long (minutes or hours) delays. This same application has been working fine from Windows XP through (at l

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 06:55

    This is expected, valid behavior. The documentation is very explicit, stating:

    these sleep times are not guaranteed to be precise, because they are limited by the facilities provided by the underlying OS.

    and:

    In any case, you cannot assume that invoking sleep will suspend the thread for precisely the time period specified.

提交回复
热议问题