more changes
[IRC.git] / Robust / src / Tests / Atomic2.java
1 public class Atomic2 extends Thread {
2     public Atomic2() {
3     }
4     int count;
5     public static void main(String[] st) {
6         //int mid = (128<<24)|(200<<16)|(9<<8)|26;
7         int mid = (128<<24)|(195<<16)|(175<<8)|70;
8         Atomic2 t =null;
9         atomic {
10             t= global new Atomic2();
11             t.count=0;
12         }
13         System.printString("Starting\n");
14         t.start(mid);
15         System.printString("Finished\n");
16         /* Test thread join */
17         t.join();
18         //this is ugly...
19         while(true) {
20             atomic {
21                 t.count++;
22             }
23         }
24     }
25
26     public int run() {
27         while(true) {
28             int tmpcount;
29             atomic {
30                 tmpcount=count;
31             }
32             System.printString("Current count=");
33             System.printInt(tmpcount);
34             System.printString("\n");
35         }
36     }
37 }
38