Hi Igor,

Thanks for the short explanation, and forwarding to list. Sorry, somehow this 
went off the list.

ganesh

--- On Sun, 21/3/10, Igor Peshansky <ig...@us.ibm.com> wrote:

> From: Igor Peshansky <ig...@us.ibm.com>
> Subject: Re: [X10-users] Using 'await'
> To: "Ganesh Venkateshwara" <tovgan...@yahoo.co.in>
> Date: Sunday, 21 March, 2010, 6:29 PM
> Ganesh Venkateshwara <tovgan...@yahoo.co.in>
> wrote on 03/21/2010 08:01:45 
> AM:
> 
> > Hi Igor,
> 
> Hi, Ganesh,
> 
> Maybe it's best to keep this on-list...  Care to
> re-reply there, and
> I'll re-send this there as well?
> 
> > Thanks, your suggestion does work. But this was not so
> apparent. Is 
> > await supposed to work like Java's wait( ) notify()?
> 
> X10 does not have a memory model.  Thus, the only
> writes that are
> guaranteed to be visible are atomic writes.
> 
> > Also I get the following warning with the addition of
> atomic:
> > test.x10:26: WARNING (should be error, but method
> annotations in XRX 
> > are wrong): method public
> test.Incrementor.increment(): x10.lang.Void:
> > Only nonblocking methods can be called from
> nonblocking code.
> > 
> > Which is solved if I declare the method increment() to
> be atomic.
> 
> Yes, sorry, forgot about that.  You don't need to
> declare increment()
> as atomic, just nonblocking.  If you do declare it to
> be atomic, there
> is no need for the separate atomic statemennt in the
> async.
>         Igor
> 
> > ----- Original Message ----
> > From: Igor Peshansky <ig...@us.ibm.com>
> > To: x10-users@lists.sourceforge.net
> > Sent: Sat, 20 March, 2010 1:30:17 AM
> > Subject: Re: [X10-users] Using 'await'
> > 
> > Ganesh Venkateshwara <tovgan...@yahoo.co.in>
> wrote on 03/19/2010 
> 01:27:51 
> > AM:
> > 
> > > Hi,
> > > 
> > > I am trying to use await with an async operation
> as in the attached 
> > > code. The code compiles, but it simply waits
> infinitely at the await 
> > statement.
> > > I am most probably doing something strange, and
> await is not expected 
> > > to work like this?
> > > 
> > > Let me know if any of you have tried using await
> for such scenario.
> > 
> > Hi, Ganesh,
> > 
> > I believe you're only guaranteed to see the results of
> an atomic update
> > in the when (await) expression.  Try changing the
> relevant lines to
> > 
> >         async atomic
> inc.increment();
> >         await
> inc.incremented;
> > 
> > Hope this helps,
> >         Igor
> > 
> > >
> -----------------------------------------------------
> > > public class test {
> > >    class Incrementor {
> > >         var i:Int;
> > >         var
> incremented:Boolean;
> > > 
> > >         public def
> this() {
> > >         
>    i = 0;
> > >         
>    incremented = false;
> > >         }
> > > 
> > >         public def
> increment() {
> > >         
>    Console.OUT.println("Entering increment():
> " + 
> incremented);
> > > 
> > >         
>    i++;
> > >         
>    incremented = true;
> > > 
> > >         
>    Console.OUT.println("Leaving increment():
> " + 
> incremented);
> > >         }
> > >     }
> > > 
> > >     def func() {
> > >         val inc =
> new Incrementor();
> > > 
> > >         async
> inc.increment();
> > >         await
> inc.incremented;
> > > 
> > >     
>    Console.OUT.println("Its done: " +
> inc.i);
> > >     }
> > > 
> > >     public static def
> main(args:Rail[String]) {
> > >        (new test()).func();
> > >     }
> > > }
> -- 
> Igor Peshansky  (note the spelling change!)
> IBM T.J. Watson Research Center
> X10: Parallel Productivity and Performance (http://x10-lang.org/)
> XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
> "I hear and I forget.  I see and I remember.  I
> do and I understand" -- 
> Confucius
> 
> 


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to