Navigation Menu

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

Add reference_count method to servo_arc::Arc. #23968

Open
carado opened this issue Aug 14, 2019 · 0 comments
Open

Add reference_count method to servo_arc::Arc. #23968

carado opened this issue Aug 14, 2019 · 0 comments

Comments

@carado
Copy link

carado commented Aug 14, 2019

In my own usage of servo_arc, I have come across a case where an object, when dropped, will remove itself from a collection. The collection owns a servo_arc::Arc<Thing>, and the user dropping the object is dropping another servo_arc::Arc<Thing>; so the object needs to remove itself from the collection if its reference count is 2, not if it's 1.

Unfortunately, servo_arc::Arc only provides is_unique(). Would it be possibly to add a reference_count(&self) -> usize method to servo_arc::Arc, analogous to std::sync::Arc's strong_count ?

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

No branches or pull requests

1 participant