Hi, There are really 3 activities registered with the clock: not only A and B but also the parent activity while in the body of the clocked finish.
If A is spawned first and reaches advanceAll before B is spawned then A has to wait on the parent activity. The parent activity only releases the clock (reaches the end of the finish scope) after spawning B. So the error scenario you are describing cannot occur. Olivier LEONID ILYEVSKY <leonidilyev...@yahoo.com> wrote on 04/30/2013 10:44:15 AM: > From: LEONID ILYEVSKY <leonidilyev...@yahoo.com> > To: Mailing list for users of the X10 programming language <x10- > us...@lists.sourceforge.net> > Date: 04/30/2013 10:46 AM > Subject: [X10-users] Clocked async question > > I am looking at the example from the language spec (section15.4): > > clocked finish { > clocked async { > phase("A", 1); > Clock.advanceAll(); > phase("A", 2); > } > clocked async { > phase("B", 1); > Clock.advanceAll(); > phase("B", 2); > } > } > > As far as I understand, this is going to work as intended only if > the launching of activities follow a specific rule: > > 1. We enter the "clocked finish" block. > 2. Both activities A and B are created and registered with the > clock, but they are not active yet. > 3. Activities A and B become active and they proceed as we expect. > > Otherwise it might be a problem: if activity A becomes active before > B is registered with the clock, then A may proceed with advanceAll > (), because at the point the clock does not know anything about B. > > Could anybody confirm that my understanding is correct, and where in > the spec it explains what is the sequence of creating activities, > making them active, registering with clocks, etc. Looks to me that > in the above example the compiler has to do it properly based on the > fact that two activities are specified next to each other inside a block. > ------------------------------------------------------------------------------ > Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET > Get 100% visibility into your production application - at no cost. > Code-level diagnostics for performance bottlenecks with <2% overhead > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap1 > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users ------------------------------------------------------------------------------ Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with <2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1 _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users