diff options
| author | kennytm <kennytm@gmail.com> | 2018-04-05 16:51:16 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-05 16:51:16 +0800 |
| commit | 920249abdd974caf4f0ea4ddbe068848beb0f1f2 (patch) | |
| tree | bf453510c153d60b4c81a64829413ab5ead61e90 /src/liballoc_system | |
| parent | 4bf76d6745046af32d0c0f33484aa15bab1c0e2c (diff) | |
| parent | 0f5e4191632de4bbc1ef4ef2be26b517861cbff0 (diff) | |
| download | rust-920249abdd974caf4f0ea4ddbe068848beb0f1f2.tar.gz rust-920249abdd974caf4f0ea4ddbe068848beb0f1f2.zip | |
Rollup merge of #48658 - llogiq:no-more-cas, r=kennytm
Add a generic CAS loop to std::sync::Atomic* This adds two new methods to both `AtomicIsize` and `AtomicUsize` with optimized safe compare-and-set loops, so users will no longer need to write their own, except in *very* strange circumstances. `update_and_fetch` will apply the function and return its result, whereas `fetch_and_update` will apply the function and return the previous value. This solves #48384 with `x.update_and_fetch(|x| x.max(y))`. It also relates to #48655 (which I misuse as tracking issue for now).. *note* This *might* need a crater run because the functions could clash with third party extension traits.
Diffstat (limited to 'src/liballoc_system')
0 files changed, 0 insertions, 0 deletions
