Thread-safe queue in Javascript or jQuery
- by at
I have many asynchronous AJAX calls whose results will get processed. It doesn't matter what order the processing occurs, but the results need to get processed one at a time. So I'd like to simple do my AJAX calls and they all just put their results in a single queue. That queue should then get processed on a single thread. This way the results get processed one at a time as soon as possible.
What's the best way to do this? I'm using jQuery, so happy to take advantage of any facilities it provides for this.