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

Remove the 'static bounds #205

Open
ghost opened this issue Feb 28, 2018 · 0 comments
Open

Remove the 'static bounds #205

ghost opened this issue Feb 28, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 28, 2018

The reason why we require K: 'static and V: 'static on methods that remove elements is that removed nodes are added to the global epoch-based garbage collector. Nodes in the GC's garbage queue might get destroyed very late in the future, potentially after the skip list itself is dropped. If K or V hold any references, their destructors must be called before those references expire, hence the very conservative 'static bounds.

We can remove the 'static bounds only if we somehow guarantee that all garbage nodes added to the GC are destroyed before the parent skip list is dropped.

The easiest way to solve the problem is probably to create a new Collector in SkipList::new so that each skip list owns its GC, which gets dropped together with the skip list (dropping a GC destroys all remaining garbage in it).

@ghost ghost transferred this issue from crossbeam-rs/crossbeam-skiplist Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

0 participants