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

Mutable exchange #271

Merged
merged 2 commits into from
May 27, 2019
Merged

Mutable exchange #271

merged 2 commits into from
May 27, 2019

Conversation

frankmcsherry
Copy link
Member

This PR changes the closure type used for data exchange from Fn to FnMut, allowing it to own its own mutable state and preventing it from being called concurrently.

The motivation is that some more sophisticated exchange functions might take e.g. a Vec<D> and pick out a subset of elements, and hash the result. This is easiest when the closure owns its own Vec<D> that can be populated (or even a Vec<&D>, though lifetimes probably prevent that).

@frankmcsherry
Copy link
Member Author

Apparently it also includes some changes to ParkEvent...

@frankmcsherry
Copy link
Member Author

The PR also raises the question of whether more functions should be FnMut rather than Fn. For example, the functions for map and filter are Fn, whereas those for inspect are FnMut.

@frankmcsherry frankmcsherry merged commit ba22fe3 into master May 27, 2019
@frankmcsherry frankmcsherry deleted the mutable_exchange branch May 27, 2019 14:16
@github-actions github-actions bot mentioned this pull request Oct 29, 2024
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

Successfully merging this pull request may close these issues.

1 participant