Skip to content

DRY race::OnceRef::{get_or_try_init, set}.#286

Merged
matklad merged 2 commits intomatklad:masterfrom
briansmith:b/once-ref-dry
Mar 28, 2025
Merged

DRY race::OnceRef::{get_or_try_init, set}.#286
matklad merged 2 commits intomatklad:masterfrom
briansmith:b/once-ref-dry

Conversation

@briansmith
Copy link
Contributor

Centralize all the pointer type casting and RMW into a new compare_exchange function as was done in other types in the module. Leave the dereferencing of the pointer in init() as set() doesn't ever use the old value.

@briansmith
Copy link
Contributor Author

I think this is the last one 😄.

@matklad
Copy link
Owner

matklad commented Mar 28, 2025

If it is last, lest bump patch in Cargo.toml!

Centralize all the pointer type casting and RMW into a new
`compare_exchange` function as was done in other types in the module.
Leave the dereferencing of the pointer in `init()` as `set()` doesn't
ever use the old value.
@briansmith
Copy link
Contributor Author

If it is last, lest bump patch in Cargo.toml!

Done.

@matklad matklad merged commit 29e3d93 into matklad:master Mar 28, 2025
1 check passed
@briansmith briansmith deleted the b/once-ref-dry branch March 31, 2025 21:08
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.

2 participants