提交 ec4f0640 编写于 作者: A alanb

6818464: TEST_BUG: java/util/Timer/KillThread.java failing intermittently

Reviewed-by: dholmes, alanb, forax
Contributed-by: gary.adams@oracle.com
上级 96a915ac
......@@ -32,20 +32,25 @@ import java.util.*;
public class KillThread {
public static void main (String[] args) throws Exception {
final Thread[] tdThread = new Thread[1];
Timer t = new Timer();
// Start a mean event that kills the timer thread
t.schedule(new TimerTask() {
public void run() {
tdThread[0] = Thread.currentThread();
throw new ThreadDeath();
}
}, 0);
// Wait for mean event to do the deed and thread to die.
try {
Thread.sleep(100);
do {
Thread.sleep(100);
} while(tdThread[0] == null);
} catch(InterruptedException e) {
}
tdThread[0].join();
// Try to start another event
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册