channel: use AtomicUsize::get_mut in flavors::{array,list}::Channel::drop#811
Merged
bors[bot] merged 3 commits intocrossbeam-rs:masterfrom Apr 11, 2022
Merged
channel: use AtomicUsize::get_mut in flavors::{array,list}::Channel::drop#811bors[bot] merged 3 commits intocrossbeam-rs:masterfrom
AtomicUsize::get_mut in flavors::{array,list}::Channel::drop#811bors[bot] merged 3 commits intocrossbeam-rs:masterfrom
Conversation
As access to `&mut self` in `Drop` impls gives exclusive access, it's unnecessary to atomically load `self.head` and `self.tail` there.
Contributor
Author
|
I stumbled across this as I was reading the code for educational purposes |
AtomicUsize::get_mut in flavors::array::Channel::dropAtomicUsize::get_mut in flavors::array::Channel::drop
AtomicUsize::get_mut in flavors::array::Channel::dropAtomicUsize::get_mut in flavors::{array,list}::Channel::drop
Member
|
Thanks! I'll merge this once the upstream bugfix (rust-lang/rust#95621) which fixes the breakage on miri CI merged. |
Contributor
|
You could temporarily remove the |
Member
|
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. |
Member
|
bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As access to
&mut selfinDropimpls gives exclusive access, it'sunnecessary to atomically load
self.headandself.tailthere.