More classes for galois
[IRC.git] / Robust / src / ClassLibrary / MGC / Thread.java
1 public class Thread implements Runnable {
2   private boolean finished;
3   Runnable target;
4   private boolean daemon;
5   
6   public Thread(){
7     finished = false;
8     target = null;
9   }
10   
11   public Thread(Runnable r) {
12     finished = false;
13     target = r;
14   }
15
16   public void start() {
17     nativeCreate();
18   }
19
20   private static void staticStart(Thread t) {
21     t.run();
22     t.finished = true;
23   }
24
25   public static native void yield();
26
27   public void join() {
28     nativeJoin();
29   }
30
31   private native void nativeJoin();
32
33   public native static void sleep(long millis);
34
35   public void run() {
36     if(target != null) {
37       target.run();
38     }
39     this.finished = true;
40   }
41
42   private native void nativeCreate();
43   
44   public final boolean isAlive() {
45     return !this.finished;
46   }
47   
48   public native ThreadLocalMap getThreadLocals();
49   
50   public final synchronized void setDaemon(boolean daemon) {
51     /*if (vmThread != null)
52       throw new IllegalThreadStateException();
53     checkAccess();*/
54     this.daemon = daemon;
55   }
56   
57   public static Thread currentThread()
58   {
59     System.out.println("Unimplemented Thread.currentThread()!");
60     return null;
61   }
62
63 }