Created
February 12, 2010 23:37
-
-
Save davidjrice/303112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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