631 |
|
} |
632 |
|
|
633 |
|
/** |
634 |
+ |
* Waits up to LONG_DELAY_MS for the given thread to enter a wait |
635 |
+ |
* state: BLOCKED, WAITING, or TIMED_WAITING. |
636 |
+ |
*/ |
637 |
+ |
void waitForThreadToEnterWaitState(Thread thread) { |
638 |
+ |
waitForThreadToEnterWaitState(thread, LONG_DELAY_MS); |
639 |
+ |
} |
640 |
+ |
|
641 |
+ |
/** |
642 |
|
* Returns the number of milliseconds since time given by |
643 |
|
* startNanoTime, which must have been previously returned from a |
644 |
|
* call to {@link System.nanoTime()}. |
675 |
|
} |
676 |
|
} |
677 |
|
|
678 |
+ |
/** |
679 |
+ |
* Waits for LONG_DELAY_MS milliseconds for the thread to |
680 |
+ |
* terminate (using {@link Thread#join(long)}), else interrupts |
681 |
+ |
* the thread (in the hope that it may terminate later) and fails. |
682 |
+ |
*/ |
683 |
+ |
void awaitTermination(Thread t) { |
684 |
+ |
awaitTermination(t, LONG_DELAY_MS); |
685 |
+ |
} |
686 |
+ |
|
687 |
|
// Some convenient Runnable classes |
688 |
|
|
689 |
|
public abstract class CheckedRunnable implements Runnable { |