Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request support for n parallel threads #1

Closed
wampleek opened this issue Dec 21, 2011 · 2 comments
Closed

Request support for n parallel threads #1

wampleek opened this issue Dec 21, 2011 · 2 comments

Comments

@wampleek
Copy link

Hey, I've been using asyncblock for a couple weeks now, and I love the concise syntax. Recently I ran into a situation where I would like to have n parallel execution threads going at once. I've settled on something like:

for(var i = 0; i < numberOfExecutions; i++) {
    doTask(flow.add());
    if(i % 10 === 0) {
        flow.wait();
    }
}
flow.wait();

This works somewhat well. It will kick off 10 tasks at once, but will wait for all 10 to complete before issuing new tasks. It would be nice if I could have 10 tasks going at once until they all complete. What do you think?

@scriby
Copy link
Owner

scriby commented Dec 21, 2011

Sounds like a great idea.

@scriby
Copy link
Owner

scriby commented Dec 22, 2011

Version 0.6.1 addresses this. Set flow.maxParallel to control the number of simultaneous tasks to run in parallel.

@scriby scriby closed this as completed Dec 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants