Open jrmuizel opened 4 years ago
Would a PR to implement this be accepted?
@Restioson
Would a PR to implement this be accepted?
Yes, that would be great! It should probably be simulated using Atomic::unsync_load
:
https://github.com/tokio-rs/loom/blob/73e6c14da41978e7a20e1993c2554a16a3dcb597/src/rt/atomic.rs#L200-L216
We might want to add get_mut
methods to the other loom
atomic types, like AtomicUsize
, since they also have get_mut
methods.
If we do get_mut()
it needs to return a guard type and not the ptr itself. loom needs to know when the ptr is no longer accessible in order to ensure correctness. This is why other types have with_mut
but that can be changed to a guard type return as well instead of a closure.
Would the logic be essentially the same as with_mut otherwise? The cleanup moved to the drop impl and the setup to the get_mut function?
The AtomicPtr implementation seems to be missing an implementation of get_mut