Here you can find the source of sleep(long msecs, boolean busy_sleep)
public static void sleep(long msecs, boolean busy_sleep) throws InterruptedException
//package com.java2s; public class Main { /** Sleep for timeout msecs. Returns when timeout has elapsed or thread was interrupted */ public static void sleep(long timeout) throws InterruptedException { // try { Thread.sleep(timeout);//from www.j a v a 2s.co m // } // catch(Exception e) { // GemStoneAddition // } } /** * On most UNIX systems, the minimum sleep time is 10-20ms. Even if we specify sleep(1), the thread will * sleep for at least 10-20ms. On Windows, sleep() seems to be implemented as a busy sleep, that is the * thread never relinquishes control and therefore the sleep(x) is exactly x ms long. */ public static void sleep(long msecs, boolean busy_sleep) throws InterruptedException // GemStoneAddition { if (Thread.interrupted()) throw new InterruptedException(); // GemStoneAddition if (!busy_sleep) { sleep(msecs); return; } long start = System.currentTimeMillis(); long stop = start + msecs; while (stop > start) { start = System.currentTimeMillis(); } } }