On 7/25/2011 4:57 AM, Andreas Zwinkau wrote:
> This example program does not terminate:
>
> class Test {
>       public static def main(args:Array[String]) {
>               val flag = Cell.make[boolean](false);
>               async {
>                       flag() = true;
>               }
>               when (flag()) ;
>       }
> }
>
> It does terminate, if the async block is made atomic.
>
> Internally, the when-condition blocks and wakes up, whenever an atomic
> block ends. This is a reasonable efficiency optimization to avoid
> polling (ironically, a spin lock is used). My complain is that this
> behavior is not intuitive and not specified (at least not in X10-2.2.0
> ยง14.7.1).
Correct, the behavior is as intended, and should be reflected in the 
language manual if it is not.

When conditions may only see changes to variables made within atomic 
blocks.

(Note that a when is not guaranteed to see *every* change to a variable 
it is monitoring, even if that change is made within an atomic.)





------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to