Sleep and check until condition is true

后端 未结 7 2090
借酒劲吻你
借酒劲吻你 2020-12-16 11:39

Is there a library in Java that does the following? A thread should repeatedly sleep for x milliseconds until a condition becomes true or the max t

7条回答
  •  囚心锁ツ
    2020-12-16 11:51

    You should not sleep and check and sleep and check. You want to wait on a condition variable and have the condition change and wake up the thread when its time to do something.

提交回复
热议问题