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

when(fulfilled:…) should be able to resolve synchronously #52

Closed
lilyball opened this issue May 20, 2020 · 0 comments
Closed

when(fulfilled:…) should be able to resolve synchronously #52

lilyball opened this issue May 20, 2020 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@lilyball
Copy link
Owner

The when(fulfilled:…) family takes a QoS and does all of its work there. The downside here is it can't resolve synchronously even if all inputs have resolved. By contrast, when(first:cancelRemaining:) will resolve synchronously if any of the inputs have fulfilled/rejected.

Implementation note: One solution is to use .nowOr(_:) (see #34) on the interior work. We can then test the group to see if it's ready synchronously. We could also rewrite the enqueue loop to only hop on the context if it's rejecting/cancelling, because writing to resultBuffer can happen on any thread. Note that in this case we can still do the group.leave() outside of the context, as the resultBuffer entry will be nil and thus our processing of the buffer will safely abort.

@lilyball lilyball added the bug Something isn't working label May 20, 2020
@lilyball lilyball added this to the Next milestone May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant