put thread into runnable state in Thread.start

This commit is contained in:
Joel Dice 2009-08-10 17:36:11 -06:00
parent 28b5c46a0b
commit d868815737

View File

@ -86,8 +86,11 @@ public class Thread implements Runnable {
throw new IllegalStateException("thread already started"); throw new IllegalStateException("thread already started");
} }
state = (byte) State.RUNNABLE.ordinal();
peer = doStart(); peer = doStart();
if (peer == 0) { if (peer == 0) {
state = (byte) State.NEW.ordinal();
throw new RuntimeException("unable to start native thread"); throw new RuntimeException("unable to start native thread");
} }
} }
@ -95,7 +98,6 @@ public class Thread implements Runnable {
private native long doStart(); private native long doStart();
private static void run(Thread t) throws Throwable { private static void run(Thread t) throws Throwable {
t.state = (byte) State.RUNNABLE.ordinal();
try { try {
t.run(); t.run();
} catch (Throwable e) { } catch (Throwable e) {