Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fixes #946 -- return both the old and new values in Atomic::compare_exchange#1197

Merged
taiki-e merged 2 commits into
crossbeam-rs:masterfrom
alex:compare-exchange-fix
Feb 14, 2026
Merged

fixes #946 -- return both the old and new values in Atomic::compare_exchange#1197
taiki-e merged 2 commits into
crossbeam-rs:masterfrom
alex:compare-exchange-fix

Conversation

@alex
Copy link
Copy Markdown
Contributor

@alex alex commented Jun 8, 2025

Fixes #946

@alex
Copy link
Copy Markdown
Contributor Author

alex commented Jun 8, 2025

I decided returning both made more sense than trying to just mirror the stdlib's API, because of the extreme risk existing code wouldn't notice the behavior change unless types also changed.

@alex
Copy link
Copy Markdown
Contributor Author

alex commented Jun 8, 2025

the CI failures appear to be the ones fixed by #1196. I can rebase after that merges.

Copy link
Copy Markdown
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks! It's interesting that this also revealed mistakes in our code (fetch_update) and example (compare_exchange_weak).

@taiki-e taiki-e merged commit 7e086a2 into crossbeam-rs:master Feb 14, 2026
29 checks passed
@alex
Copy link
Copy Markdown
Contributor Author

alex commented Feb 14, 2026

Thanks!

@alex alex deleted the compare-exchange-fix branch February 14, 2026 23:04
@taiki-e taiki-e mentioned this pull request Feb 22, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Confusing compare_exchange api in crossbeam_epoch::Atomic

2 participants