Hi,

        I think there is a misunderstanding about what Clock.advanceAll()
does in the presence of nested clocked finishes.  Namely, it advances all
clocks of the activity (both inner and outer).  This points to perhaps a
mistake made in the specification when we replaced the next keyword with
Clock.advanceAll() (I will take a look).   In the case of nested clocks, we
should have used Clock.advance().

        To illustrate, I added print statements to the more complex program,
run on Native X10, and I see output that is consistent with this
interpretation of Clock.advanceAll:

[dgrove@linchen myTests]$ x10c++ Test1.x10
[dgrove@linchen myTests]$ ./a.out
Outer, tick 0 x=-1
Inner 2, tick 0 x=-1
Inner 1, tick 0 x=-1
Outer, tick 1 x=-1
Outer, tick 1 after assign x=3
Inner 2, tick 1 x=3
Inner 1, tick 1 x=3
Inner 1, tick 2 x=3
Inner 1, tick 2 after assign x=1
Inner 2, tick 2 x=3
Inner 2, tick 3 x=1
Inner 2, tick 3 after assign x=0
x=0

The programs is appended.

--dave

class Test1 {
  public static def main(Rail[String]) {
     var x: Long = -1;

     clocked finish {
        clocked async {
           clocked finish {
              Console.OUT.println("Inner 1, tick 0 x="+x);
              Clock.advanceAll();
              Console.OUT.println("Inner 1, tick 1 x="+x);
              Clock.advanceAll();
              Console.OUT.println("Inner 1, tick 2 x="+x);
              x= 1;
              Console.OUT.println("Inner 1, tick 2 after assign x="+x);
           }
        }
        clocked async {
           clocked finish {
              Console.OUT.println("Inner 2, tick 0 x="+x);
              Clock.advanceAll();
              Console.OUT.println("Inner 2, tick 1 x="+x);
              Clock.advanceAll();
              Console.OUT.println("Inner 2, tick 2 x="+x);
              Clock.advanceAll();
              Console.OUT.println("Inner 2, tick 3 x="+x);
              x= 0;
              Console.OUT.println("Inner 2, tick 3 after assign x="+x);
           }
        }
        Console.OUT.println("Outer, tick 0 x="+x);
        Clock.advanceAll();
        Console.OUT.println("Outer, tick 1 x="+x);
        x = 3;
        Console.OUT.println("Outer, tick 1 after assign x="+x);
     }

     Console.OUT.println("x="+x);
  }
}
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to