mp3decoder finally passes the flow-down rule checking.
[IRC.git] / Robust / src / Tests / VolatileTest.java
1 public class VInt {
2   public int num;
3   
4   public VInt() {
5     this.num = 0;
6   }
7 }
8
9 public class VolatileTest  extends Thread {
10   volatile VInt vi;   
11   String name;
12   
13   public VolatileTest(String name, VInt vi) {
14     this.name = name;
15     this.vi = vi;
16   }
17
18   public void run(){
19     if(name.equals("Thread1")){  
20       vi.num=10;  
21     }  
22     else{  
23       System.out.println("value of num is :"+vi.num);  
24     }     
25   }  
26
27   public static void main(String args[]){  
28     VInt vi = new VInt();
29     
30     Thread t1 = new VolatileTest("Thread1", vi);   
31     t1.start();  
32
33     Thread.sleep(1000);  
34
35     Thread t2 = new VolatileTest("Thread2", vi);   
36     t2.start();  
37   }  
38 }