implement Runtime.addShutdownHook and Thread.setDaemon; avoid segfaults due to an application calling e.g. CallStaticBooleanMethod when it really meant CallStaticVoidMethod

This commit is contained in:
Joel Dice
2009-08-19 14:27:03 -06:00
parent df3baeb83b
commit c4b5ecec90
6 changed files with 189 additions and 81 deletions

View File

@ -252,10 +252,14 @@ public class Thread implements Runnable {
return daemon;
}
public void setDaemon(boolean v) {
daemon = v;
public synchronized void setDaemon(boolean v) {
if (v != daemon) {
setDaemon(this, v);
}
}
private static native void setDaemon(Thread t, boolean increment);
public static native void yield();
public synchronized void join() throws InterruptedException {