advanced code snippet search
mamoo on 10/09/08
java delay
10/09/08 03:42am
protected void delay(long milliseconds) throws Exception{ Calendar now = Calendar.getInstance(); while ((Calendar.getInstance().getTimeInMillis() - now.getTimeInMillis()) < milliseconds){}}
Report this snippet Tweet
This will hog your CPU! At least call sleep!!
omg!!! very cpu consuming!!! use int ms = 500; try { Thread.sleep(ms); } catch (InterruptedException e) {}
instead
Comment:
You need to login to post a comment.
This will hog your CPU! At least call sleep!!
omg!!! very cpu consuming!!! use int ms = 500;
try { Thread.sleep(ms); } catch (InterruptedException e) {}
instead