(long milliseconds)
| 159 | } |
| 160 | |
| 161 | public static void sleep(long milliseconds) throws InterruptedException { |
| 162 | if (milliseconds <= 0) { |
| 163 | milliseconds = 1; |
| 164 | } |
| 165 | |
| 166 | Thread t = currentThread(); |
| 167 | if (t.sleepLock == null) { |
| 168 | t.sleepLock = new Object(); |
| 169 | } |
| 170 | synchronized (t.sleepLock) { |
| 171 | t.sleepLock.wait(milliseconds); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | public static void sleep(long milliseconds, int nanoseconds) |
| 176 | throws InterruptedException |