Name: vi73552 Date: 03/24/99
Bug 4082713 concerns the problem that, contrary to the specification, you can start() a thread after invoking stop() on it.
Bug 4082713 is incorrectly labelled as a duplicate of 4145910 but they are quite different. The only relationship between them is the incorrect usage of the stillborn and privateinof flags in start(), stop() and isAlive(). They are different symptoms of the same underlying problem.
When stop() is invoked it should set the stillborn flag to true. When start() is invoked it should check the stillborn flag and ignore the request if stillborn is true.
The following code demonstrates that you can start a thread that was previously stopped.
public class testStartStoppedThread {
public static void main(String[] args){
Thread t = new Thread( new Runnable() {
public void run(){
for (;;) {
try {
System.out.println("Thread running");
Thread.sleep(500);
}
catch(InterruptedException ex){}
}
}
});
System.out.println("invoking t.stop()");
t.stop();
System.out.println("t is alive? " + t.isAlive() );
System.out.println("invoking t.start()");
t.start();
System.out.println("t is alive? " + t.isAlive() );
}
}
(Review ID: 56051)
======================================================================
Bug 4082713 concerns the problem that, contrary to the specification, you can start() a thread after invoking stop() on it.
Bug 4082713 is incorrectly labelled as a duplicate of 4145910 but they are quite different. The only relationship between them is the incorrect usage of the stillborn and privateinof flags in start(), stop() and isAlive(). They are different symptoms of the same underlying problem.
When stop() is invoked it should set the stillborn flag to true. When start() is invoked it should check the stillborn flag and ignore the request if stillborn is true.
The following code demonstrates that you can start a thread that was previously stopped.
public class testStartStoppedThread {
public static void main(String[] args){
Thread t = new Thread( new Runnable() {
public void run(){
for (;;) {
try {
System.out.println("Thread running");
Thread.sleep(500);
}
catch(InterruptedException ex){}
}
}
});
System.out.println("invoking t.stop()");
t.stop();
System.out.println("t is alive? " + t.isAlive() );
System.out.println("invoking t.start()");
t.start();
System.out.println("t is alive? " + t.isAlive() );
}
}
(Review ID: 56051)
======================================================================
- duplicates
-
JDK-4519200 (thread) Started thread does not terminate immediately if it was stopped before
- Resolved