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

Ability yield to an Execution #28

Closed
cowboyd opened this issue Nov 11, 2019 · 1 comment
Closed

Ability yield to an Execution #28

cowboyd opened this issue Nov 11, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@cowboyd
Copy link
Member

cowboyd commented Nov 11, 2019

It's a commonly emerging pattern to be able fork off an operation that itself has several parallel forks within it. Then, at some later point, you want to wait until all the children are finished. An example of this is the piping that happens in the bigtest proxy server. There are two or three async operations copying data through the pipe, but once they're all finished only then do we want to continue.

In order to support this we need a way to yield to an execution. E.g.

yield fork(function*() {
  fork(one);
  fork(two);
  yield on(emitter, "end");
}

In other words, we want to wait until all sub children are finished.

@cowboyd cowboyd added enhancement New feature or request and removed triage labels Nov 11, 2019
@cowboyd
Copy link
Member Author

cowboyd commented Jan 30, 2020

As of #57, you can now join an execution with the join operator:

let wait = yield fork(timeout(5000));
yield join(wait);

@cowboyd cowboyd closed this as completed Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant