332 * Causes the current thread to wait until it is awakened, typically
333 * by being <em>notified</em> or <em>interrupted</em>, or until a
334 * certain amount of real time has elapsed.
335 * <p>
336 * In all respects, this method behaves as if {@code wait(timeout, 0)}
337 * had been called. See the specification of the {@link #wait(long, int)} method
338 * for details.
339 *
340 * @param timeout the maximum time to wait, in milliseconds
341 * @throws IllegalArgumentException if the value of {@code timeout} is negative
342 * @throws IllegalMonitorStateException if the current thread is not
343 * the owner of the object's monitor
344 * @throws InterruptedException if any thread interrupted the current thread before or
345 * while the current thread was waiting. The <em>interrupted status</em> of the
346 * current thread is cleared when this exception is thrown.
347 * @see #notify()
348 * @see #notifyAll()
349 * @see #wait()
350 * @see #wait(long, int)
351 */
352 public final native void wait(long timeout) throws InterruptedException;
353
354 /**
355 * Causes the current thread to wait until it is awakened, typically
356 * by being <em>notified</em> or <em>interrupted</em>, or until a
357 * certain amount of real time has elapsed.
358 * <p>
359 * The current thread must own this object's monitor lock. See the
360 * {@link #notify notify} method for a description of the ways in which
361 * a thread can become the owner of a monitor lock.
362 * <p>
363 * This method causes the current thread (referred to here as <var>T</var>) to
364 * place itself in the wait set for this object and then to relinquish any
365 * and all synchronization claims on this object. Note that only the locks
366 * on this object are relinquished; any other objects on which the current
367 * thread may be synchronized remain locked while the thread waits.
368 * <p>
369 * Thread <var>T</var> then becomes disabled for thread scheduling purposes
370 * and lies dormant until one of the following occurs:
371 * <ul>
372 * <li>Some other thread invokes the {@code notify} method for this
|
332 * Causes the current thread to wait until it is awakened, typically
333 * by being <em>notified</em> or <em>interrupted</em>, or until a
334 * certain amount of real time has elapsed.
335 * <p>
336 * In all respects, this method behaves as if {@code wait(timeout, 0)}
337 * had been called. See the specification of the {@link #wait(long, int)} method
338 * for details.
339 *
340 * @param timeout the maximum time to wait, in milliseconds
341 * @throws IllegalArgumentException if the value of {@code timeout} is negative
342 * @throws IllegalMonitorStateException if the current thread is not
343 * the owner of the object's monitor
344 * @throws InterruptedException if any thread interrupted the current thread before or
345 * while the current thread was waiting. The <em>interrupted status</em> of the
346 * current thread is cleared when this exception is thrown.
347 * @see #notify()
348 * @see #notifyAll()
349 * @see #wait()
350 * @see #wait(long, int)
351 */
352 public final void wait(long timeout) throws InterruptedException {
353 try {
354 wait0(timeout);
355 } catch (InterruptedException e) {
356 Thread t = Thread.currentThread();
357 if (t instanceof Fiber)
358 t.getAndClearInterrupt();
359 throw e;
360 }
361 }
362
363 // final modifier so method not in vtable
364 private final native void wait0(long timeout) throws InterruptedException;
365
366 /**
367 * Causes the current thread to wait until it is awakened, typically
368 * by being <em>notified</em> or <em>interrupted</em>, or until a
369 * certain amount of real time has elapsed.
370 * <p>
371 * The current thread must own this object's monitor lock. See the
372 * {@link #notify notify} method for a description of the ways in which
373 * a thread can become the owner of a monitor lock.
374 * <p>
375 * This method causes the current thread (referred to here as <var>T</var>) to
376 * place itself in the wait set for this object and then to relinquish any
377 * and all synchronization claims on this object. Note that only the locks
378 * on this object are relinquished; any other objects on which the current
379 * thread may be synchronized remain locked while the thread waits.
380 * <p>
381 * Thread <var>T</var> then becomes disabled for thread scheduling purposes
382 * and lies dormant until one of the following occurs:
383 * <ul>
384 * <li>Some other thread invokes the {@code notify} method for this
|