Forked from
The Tor Project / Applications / Tor Browser
Source project has a limited visibility.
-
Nika Layzell authored
This new approach to weak references is roughly modeled after the approach used by Rust's Arc<T>, and uses an atomic compare-and-swap loop to perform weak to strong reference upgrades. This approach ends up moving the strong reference count out of the tracked object and into the weak reference object, as the strong reference count atomic needs to outlife the object itself. Rust's Arc Weak::upgrade implementation: https://github.com/rust-lang/rust/blob/d98d2f57d9b98325ff075c343d2c7695b66dfa7d/library/alloc/src/sync.rs#L1806-L1837 Differential Revision: https://phabricator.services.mozilla.com/D102245
Nika Layzell authoredThis new approach to weak references is roughly modeled after the approach used by Rust's Arc<T>, and uses an atomic compare-and-swap loop to perform weak to strong reference upgrades. This approach ends up moving the strong reference count out of the tracked object and into the weak reference object, as the strong reference count atomic needs to outlife the object itself. Rust's Arc Weak::upgrade implementation: https://github.com/rust-lang/rust/blob/d98d2f57d9b98325ff075c343d2c7695b66dfa7d/library/alloc/src/sync.rs#L1806-L1837 Differential Revision: https://phabricator.services.mozilla.com/D102245