public class Thread implements Runnable {
+ static long id = 0;
private boolean finished;
Runnable target;
+ private boolean daemon;
+ private long threadId;
+ String name;
public Thread(){
finished = false;
target = null;
+ daemon = false;
+ threadId = Thread.id++;
+ }
+
+ public long getId()
+ {
+ return threadId;
}
public Thread(Runnable r) {
finished = false;
target = r;
}
+
+ public Thread(Runnable r, String n)
+ {
+ finished = false;
+ target = r;
+ name = n;
+ }
public void start() {
nativeCreate();
private static void staticStart(Thread t) {
t.run();
+ t.finished = true;
}
public static native void yield();
if(target != null) {
target.run();
}
+ this.finished = true;
}
private native void nativeCreate();
- public final native boolean isAlive();
+ public final boolean isAlive() {
+ return !this.finished;
+ }
+
+ public native ThreadLocalMap getThreadLocals();
+
+ public final synchronized void setDaemon(boolean daemon) {
+ /*if (vmThread != null)
+ throw new IllegalThreadStateException();
+ checkAccess();*/
+ this.daemon = daemon;
+ }
+
+ public static Thread currentThread()
+ {
+ System.out.println("Unimplemented Thread.currentThread()!");
+ return null;
+ }
+
+ public static Map getAllStackTraces() {
+ System.out.println("Unimplemented Thread.getAllStackTraces()");
+ return new Map();
+ }
}