Hi Tiago,

I think my description is in agreement with yours. If I translate my 
understanding it to an explicitly clocked version, I get the following:

import x10.io.Console;

class Test5 {
  public static def main(Rail[String]) {
     var x: Long = -1; 
     val c1: Clock = Clock.make();


     finish {
        async clocked (c1) {
           finish {
              val c2: Clock = Clock.make();

              c2.advance();
              c2.advance();
              x= 1;
           }   
        }   
        async clocked (c1) {
           finish {
              val c3: Clock = Clock.make();

              c3.advance();
              c3.advance();
              c3.advance();
              x= 0;
           }   
        }   
        c1.advance();
        x = 3;
     }   
    
     Console.OUT.println("x="+x);
  }
}

which returns x=3 as I expected. I believe there is either a bug in the 
implementation or an error in my translation/understanding.

Thanks,
Tomofumi Yuki

----- Original Message -----
> From: "Tiago Cogumbreiro" <cogumbre...@lasige.di.fc.ul.pt>
> To: "Mailing list for users of the X10 programming language" 
> <x10-users@lists.sourceforge.net>
> Sent: Thursday, December 4, 2014 2:31:11 PM
> Subject: Re: [X10-users] Nested Implicit Clock Behavior
> 
> Hello again Tomofumi,
> 
> Each "clocked finish" introduces a new scope of an implicit clock so the
> three activities are operating on *distinct* clocks.
> 
> Additionally, note that the termination of both clocked asyncs synchronize
> with the outermost Clock.advanceAll.
> 
> I can send you the explicit version of the same example if you want.
> 
> Cheers,
> 
> Tiago
> 
> On Thu Dec 04 2014 at 9:36:03 AM Tomofumi Yuki <tomofumi.y...@inria.fr>
> wrote:
> 
> > Hi again,
> >
> > Thank you for your quick feedback. I did test the same code again with
> > 2.5.1 and submitted a bug report. In fact, I had a question about a more
> > complicated case before I encountered the bug earlier.
> >
> > With the following code:
> >
> > import x10.io.Console;
> >
> > class Test1 {
> >   public static def main(Rail[String]) {
> >      var x: Long = -1;
> >
> >      clocked finish {
> >         clocked async {
> >            clocked finish {
> >               Clock.advanceAll();
> >               Clock.advanceAll();
> >               x= 1;
> >            }
> >         }
> >         clocked async {
> >            clocked finish {
> >               Clock.advanceAll();
> >               Clock.advanceAll();
> >               Clock.advanceAll();
> >               x= 0;
> >            }
> >         }
> >         Clock.advanceAll();
> >         x = 3;
> >      }
> >
> >      Console.OUT.println("x="+x);
> >   }
> > }
> >
> > I get the following output:
> >
> > $x10c++ Test1.x10 -o Test1; ./Test1
> > x=0
> >
> > However, I expect x=3 as output.
> >
> > The manual mentions that the inner clocked finish operates within a single
> > phase of the outer one. Therefore the last advance should halt the primary
> > activity until activities for both clocked asyncs terminate, since all
> > other calls to Clock.advanceAll is inside another clocked finish.
> >
> > Is my interpretation correct?
> >
> > Thanks,
> > Tomofumi Yuki
> >
> > ------------------------------------------------------------
> > ------------------
> > 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
> > X10-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/x10-users
> >
> 
> ------------------------------------------------------------------------------
> 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
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
> 

------------------------------------------------------------------------------
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
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to