You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
231: Avoid unnecessary synchronization in `{force,deref}_mut` r=matklad a=danielhenrymantilla
- `DerefMut` was not delegating to `force_mut()` (contary to the by-ref APIs);
- `Lazy::force_mut` was not taking advantage of exclusive-mutability access, and instead paying shared-mutability access. Mainly, in the `sync` case, it involved atomic operations which are now skipped.
Fixes#226
Co-authored-by: Daniel Henry-Mantilla <[email protected]>
Self::force()
has to synchronize the access to the raw value and/or its needed initialization, given its&
-based API, butforce_mut()
does not, thanks to the guarantees of&mut
access (e.g., https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell.html#method.get_mut).But the current implementation of
force_mut()
just defers toforce()
:once_cell/src/lib.rs
Lines 767 to 770 in 3514863
The text was updated successfully, but these errors were encountered: