Hi there,
i have a little problem with the program appended.
Compiling and running this program results in a deadlock (tested with
java- and c++-Backend).
However, if you change line 19 from "at (Place(id)) ..." to "at
(Place(0)) ..." the program runs as intended.
Surrounding the "plh().waiting = false;" with an atomic does not change
anything.
I am using rev. 27742 from the svn-repository, gcc 4.8.2, as well as jdk
1.7.0_55.
Could somebody explain me why the one method is working and the other is
not?
Cheers and thanks in advance,
Marco
public class Probe
{
var waiting:Boolean = true;
public def ding(plh:PlaceLocalHandle[Probe])
{
while (true)
{
Console.OUT.println(here + ": ding.");
at (Place(1)) async { plh().makeDong(plh, here.id()); }
while (waiting) { Runtime.probe(); }
waiting = true;
}
}
public def makeDong(plh:PlaceLocalHandle[Probe], id:Long)
{
Console.OUT.println (here + ": dong.");
at (Place(id)) async { plh().waiting = false; }
}
public static def main(args:Rail[String])
{
plh:PlaceLocalHandle[Probe]
= PlaceLocalHandle.make[Probe](PlaceGroup.WORLD
, ()=> new Probe());
plh().ding(plh);
}
}
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users