-
Notifications
You must be signed in to change notification settings - Fork 484
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
channel: use AtomicUsize::get_mut
in flavors::{array,list}::Channel::drop
#811
Conversation
As access to `&mut self` in `Drop` impls gives exclusive access, it's unnecessary to atomically load `self.head` and `self.tail` there.
I stumbled across this as I was reading the code for educational purposes |
AtomicUsize::get_mut
in flavors::array::Channel::drop
AtomicUsize::get_mut
in flavors::array::Channel::drop
AtomicUsize::get_mut
in flavors::array::Channel::drop
AtomicUsize::get_mut
in flavors::{array,list}::Channel::drop
Thanks! I'll merge this once the upstream bugfix (rust-lang/rust#95621) which fixes the breakage on miri CI merged. |
You could temporarily remove the |
Thanks for the advice. This time I chose to wait for the patch to be merged since it had already been submitted that looked reasonable. It makes sense to temporarily remove the flag if the fix is going to take a long time. |
bors r+ |
Build succeeded: |
874: Use get_mut instead of atomic load in Drop impls r=taiki-e a=taiki-e Similar to #811, but for deque and queue. Co-authored-by: Taiki Endo <[email protected]>
As access to
&mut self
inDrop
impls gives exclusive access, it'sunnecessary to atomically load
self.head
andself.tail
there.