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

Create a way to prevent collection happening #43

Open
Others opened this issue Aug 1, 2020 · 4 comments
Open

Create a way to prevent collection happening #43

Others opened this issue Aug 1, 2020 · 4 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed T-enhancement New feature or request

Comments

@Others
Copy link
Owner

Others commented Aug 1, 2020

It'd be cool if there was a guard you could hold to prevent collection, something like:

fn prevent_collection() -> PreventCollectionGuard {...}

struct PreventCollectionGuard {...}

This may be useful for preventing collection on the hot path

@Others Others added T-enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Aug 1, 2020
@Others
Copy link
Owner Author

Others commented Aug 6, 2020

prevent collection should optionally block if there is a collection happening

@alekratz
Copy link
Contributor

This is something I'd be interested in looking at when I finish up #33.

@Others
Copy link
Owner Author

Others commented Aug 10, 2020

Cool! I think we want prevent_collection to block until there is no collection going on. And when the handle drops, we want to make sure the collector has a chance to run

@Others
Copy link
Owner Author

Others commented Aug 23, 2020

@alekratz

Was thinking about this a bit more. Realized a few things:

  1. If Collector::gc_lock becomes a RWLock, that might be a start of the implementation
  2. If we implement this, we probably need a try_collect top level method, as there would now be a few ways of blocking collection
  3. PreventCollectionGuard might be useful for the deref work in the future, because it provides a guarantee that no one is concurrently scanning this data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed T-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants