start of new file
[IRC.git] / Robust / src / Benchmarks / Prefetch / Chase / Chase.java
1 public class Foo {
2     public Foo() {
3         next=null;
4     }
5     Foo next;
6 }
7
8 public class Chase extends Thread {
9     Foo base;
10     public Chase(Foo b) {
11         base=b;
12     }
13     
14     public static void main(String [] argv) {
15         Chase c;
16         atomic {
17             Foo fold=global new Foo();
18             
19             for(int i=0;i<10000;i++) {
20                 Foo f=global new Foo();
21                 f.next=fold;
22                 fold=f;
23             }
24             
25             c=global new Chase(fold);
26         }
27         c.start((128<<24)|(195<<16)|(175<<8)|71);
28         c.join();
29     }
30     
31     public void run() {
32         atomic {
33             Foo b=base;
34             while(b!=null)
35                 b=b.next;
36         }
37     }
38 }