Alternatives to Thread.Sleep()

后端 未结 11 1283
清歌不尽
清歌不尽 2020-11-27 03:48

Every N minutes we want to run through a list of tasks. So we\'ve created a task executor with a

do { DoWork(); }while(!stopRequested)

No

11条回答
  •  误落风尘
    2020-11-27 04:34

           try {
                TimeUnit.MILLISECONDS.sleep(1000L);
            } catch (InterruptedException e) {
                // handle
            }
    

提交回复
热议问题