def703fc0199b444a6b1da5cbb38da3e44f907e8
[IRC.git] / Robust / src / ClassLibrary / JavaDSM / Thread.java
1 public class Thread {
2   /* Don't allow overriding this method.  If you do, it will break dispatch
3    * because we don't have the type information necessary. */
4   public boolean threadDone;
5   public int mid;
6
7   public Thread() {
8     threadDone = false;
9   }
10
11   public static native void yield();
12
13   public final native void join();
14
15   public final native void start(int mid);
16
17   public static void myStart(Thread t, int mid)
18   {
19     atomic  {
20       t.mid = mid;
21     }
22     t.start(mid);
23   }
24
25   public native static int nativeGetStatus(int mid);
26
27   public native static void sleep(long millis);
28
29   public void run() {
30   }
31
32   public static int getStatus(int mid)
33   {
34     if(nativeGetStatus(mid)==1)
35       return 1;
36     //TODO:check if this is safe to add only for the DSM without the recovery version
37     if(nativeGetStatus(mid)==0)
38       return 1;
39     else
40       return -1;
41
42   }
43
44   public int getStatus() {
45     if(nativeGetStatus(mid)==1)
46       return 1;
47     //TODO:check if this is safe to add only for the DSM without the recovery version
48     if(nativeGetStatus(mid)==0)
49       return 1;
50     else
51       return -1;
52   }
53 }
54
55
56
57