Hi,

I am currently playing with implicit clock syntax, and even with simple 
programs, I am seeing some unexpected behavior that I cannot explain. I did a 
quick search on the past emails, and found some bug reports/fixes, but I didn't 
find anything that matches what I have.

The following code is supposed to be completely deterministic due to clocks, 
and I expect the output to be x=0. However, it always gives x=1.

import x10.io.Console;

class Test3 {
  public static def main(Rail[String]) {
     var x: Long = -1; 

     clocked finish {
        clocked async {
           Clock.advanceAll();
           x= 1;
           Clock.advanceAll();
        }   
        clocked async {
           Clock.advanceAll();
           Clock.advanceAll();
           x= 0;
        }   
        Clock.advanceAll();
     }   
    
     Console.OUT.println("x="+x);
  }
}

x10c Test3.x10; x10 Test3
x=1

Now, if I remove the last call to advanceAll (Test4, code is at bottom of 
mail), I get x=-1.

$x10c Test4.x10; x10 Test4
x=-1

My expected value is x=0. I cannot see why removing the last call to advance 
alters the behavior. If someone have any idea about this behavior, I would 
appreciate your input. 

Thank you,
Tomofumi Yuki


===Some detailed info===
I am using OSX 10.9.5

$x10c -version
x10c version 2.5.0

$java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

import x10.io.Console;

class Test4 {
  public static def main(Rail[String]) {
     var x: Long = -1; 

     clocked finish {
        clocked async {
           Clock.advanceAll();
           x= 1;
           Clock.advanceAll();
        }   
        clocked async {
           Clock.advanceAll();
           Clock.advanceAll();
           x= 0;
        }   
     }   
    
     Console.OUT.println("x="+x);
  }
}

------------------------------------------------------------------------------
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