What should I use Sleep or Timer

前端 未结 3 1715
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-18 11:51

I have two alternative using timer or using sleep, I need to call a method every 3 seconds after this method is finished, I wrote basic example to demonstrate what I mean:

3条回答
  •  鱼传尺愫
    2021-01-18 12:06

    Sleep will do the trick, Timer on the other hand has been designed for that exact purpose, conventions are better and they will usually make your code more understandable.

提交回复
热议问题