Skip to content

Instantly share code, notes, and snippets.

@davidjrice
Created February 12, 2010 23:37
Show Gist options
  • Save davidjrice/303112 to your computer and use it in GitHub Desktop.
Save davidjrice/303112 to your computer and use it in GitHub Desktop.
var items = []
// items.push({data: "..."})
// called somewhere in the code
function worker_loop(){
while(true == true){
if(items.length>0){
do_work(items.shift())
} else {
sleep(10);
}
}
}
function do_work(item){
// do some stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment