Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created July 19, 2012 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heapwolf/3145832 to your computer and use it in GitHub Desktop.
Save heapwolf/3145832 to your computer and use it in GitHub Desktop.
intro/blockingloop
var cycle = true;
var counter = 0;
function firstCallback() {
while(cycle) {
counter ++;
}
}
setTimeout(firstCallback, 100);
function secondCallback() {
cycle = false;
}
setTimeout(secondCallback, 200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment