Add hint::spin_loop() into Atomic*::*update()#159121
Conversation
`Atomic*::update()` and `Atomic*::try_update()` are implemented using a CAS loop and thus spin loop hint seems appropriate here.
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @aapoalas (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
Thanks for the pull request! I'd argue against this: the CAS will only fail if the value is concurrently being changed but That's also why e.g. |
Atomic*::update()andAtomic*::try_update()are implemented using a CAS loop and thus spin loop hint seems appropriate here.Question: are there any relevant benchmarks to run to check that this patch does not regress anything? For example, I see that
try_update()is used to implementRwLock. Are there any benchmarks forRwLock?