Thread.stop()
Jason Baker
jbaker at cs.utah.edu
Mon May 22 11:15:43 PDT 2000
Archie Cobbs <archie at whistle.com> writes:
> Email me a simple test case and I'll run it under both kaffe and JDK 1.2.
Weird. Blackdown 1.2.2 doesn't seem to asynchronously stop threads at
all, while jdk 1.1.7 can do it some of the time. Neither one seems to
throw an exception with a stack trace at all.
Jason
------------------------------------------------------------------------------
1.2.2:
nephi(53) java Die
sleeper started
doing it...
loop started
caught an error
java.lang.Error: throwing from main
done
doing it...
^C
------------------------------------------------------------------------------
1.1.7:
nephi(57) java Die
sleeper started
doing it...
loop started
caught an error
java.lang.Error: throwing from main
done
doing it...
^C
nephi(59) java Die 100
sleeper started
doing it...
loop started
caught an error
java.lang.Error: throwing from main
done
doing it...
caught an error
java.lang.Error: throwing from main
done
------------------------------------------------------------------------------
patched kaffe:
sleeper starteddoing it...
loop started
caught an error
java.lang.Error: throwing from main
at java.lang.Thread.waitOn(Thread.java:475)
at java.lang.Thread.sleep(Thread.java:364)
at Die$1.doIt(Die.java:24)
at Die.run(Die.java:7)
done
doing it...
caught an error
java.lang.Error: throwing from main
at Die.run(Die.java:7)
done
------------------------------------------------------------------------------
public abstract class Die extends Thread {
abstract void doIt();
public void run()
{
System.err.println("doing it...");
try { doIt(); }
catch (Error e) {
System.err.println("caught an error");
e.printStackTrace(System.err);
}
System.err.println("done");
}
static public void main(String[] args)
throws InterruptedException
{
int startup = 1000;
if (args.length > 0)
startup = Integer.parseInt(args[0]);
Thread u = new Die() {
void doIt() {
try { Thread.sleep(300000); }
catch (InterruptedException _) { }
}
};
u.start();
System.err.println("sleeper started");
Thread.sleep(startup);
u.stop(new Error("throwing from main"));
Thread t = new Die() {
void doIt() { while (true) ; }
};
t.start();
System.err.println("loop started");
Thread.sleep(startup);
t.stop(new Error("throwing from main"));
}
}
More information about the kaffe
mailing list