Skip to content

Instantly share code, notes, and snippets.

@dmitry-vsl
Created April 29, 2015 16:13
Show Gist options
  • Save dmitry-vsl/d737171c3810098d4496 to your computer and use it in GitHub Desktop.
Save dmitry-vsl/d737171c3810098d4496 to your computer and use it in GitHub Desktop.
var i = 0;
var r = new java.lang.Runnable(){
run: function(){
for(var j = 0; j < 1000000; j++){
i++;
}
}
};
var t1 = new java.lang.Thread(r);
var t2 = new java.lang.Thread(r);
t1.start();
t2.start();
t1.join();
t2.join();
java.lang.System.out.println(i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment