Skip to content

Conversation

iron9light
Copy link

AtomicBool::compare_and_swap was deprecated since 1.50.0.
Replace it with AtomicBool::compare_exchange.

@CLAassistant
Copy link

CLAassistant commented Feb 16, 2021

CLA assistant check
All committers have signed the CLA.

// looping as long as it returns true, so we don't need
// any explicit conversion here.
while self.init_mu.compare_and_swap(false, true, SeqCst) {}
while self.init_mu.compare_exchange(false, true, SeqCst, SeqCst).unwrap_or_else(|x| x) {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be more concise

Suggested change
while self.init_mu.compare_exchange(false, true, SeqCst, SeqCst).unwrap_or_else(|x| x) {}
while self
.init_mu
.compare_exchange(false, true, SeqCst, SeqCst)
.is_err()
{}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants