Java - alternative to thread.sleep

前端 未结 8 667
礼貌的吻别
礼貌的吻别 2020-11-30 10:00

I have a requirement to pause a while loop for a specific number of milliseconds. I have tried using Thread.sleep(duration) but it is not accurate, especially in a looping s

8条回答
  •  粉色の甜心
    2020-11-30 10:23

    Java is not a real-time system, you can not make a thread go away and come back on such a tight schedule. To schedule your program execution down to millisecond you need to use a different platform - like simpleRTJ or Java Real-Time extension.

提交回复
热议问题