Uh oh!
There was an error while loading. Please reload this page.
Change compare_exchange to return a Result<T, T> - #32244
Conversation
d7e8302 to
acb9256Comparealexcrichton
commented
Mar 14, 2016
Thanks @Amanieu! From a technical perspective the change looks good to me, just a question of APIs now! I'm tagging this with So I originally thought that this may make the classical "compare exchange loop" a little less ergnomic as getting the value out would require current: loop{let new = f(current);let old = foo.compare_exchange(current, new, ord1, ord2);if old == current {break}
current = old;}new: loop{let new = f(current);match foo.compare_exchange(current, new, ord1, ord2){Ok(..) => break,Err(old) => current = old,}}I gotta say using To get a handle on the ergonomics though it may be worthwhile to port a project like crossbeam to using this API instead of the old one (just as a smoke test) |
alexcrichton
commented
Mar 17, 2016
The libs team discussed this during triage yesterday and the conclusion was that this seems like a good change to have! It was brought up though that we may not want to change the feature names as that's kinda unnecessary breakage, would you be ok changing back? |
cb3e048 to
2964f18CompareAmanieu
commented
Mar 17, 2016
Done |
alexcrichton
commented
Mar 18, 2016
@bors: r+ 2964f1873e54b42cc3994ba8882d2486305c32c3 |
bors
commented
Mar 18, 2016
⌛ Testing commit 2964f18 with merge dedfe4a... |
bors
commented
Mar 18, 2016
💔 Test failed - auto-mac-64-opt |
2964f18 to
928d8cdCompareAmanieu
commented
Mar 18, 2016
Fixed |
928d8cd to
18222c0Compareeddyb
commented
Mar 18, 2016
@alexcrichton This will have to wait until #32080 is merged, btw. |
bors
commented
Mar 18, 2016
☔ The latest upstream changes (presumably #32080) made this pull request unmergeable. Please resolve the merge conflicts. |
4187714 to
6f0a130CompareAmanieu
commented
Mar 19, 2016
I think this should be fixed now |
alexcrichton
commented
Mar 19, 2016
@bors: r+ 6f0a1307741e7d1d297aeffd2ec15eb905e1d487 |
bors
commented
Mar 19, 2016
⌛ Testing commit 6f0a130 with merge 424af07... |
alexcrichton
commented
Mar 19, 2016
@bors: retry force clean |
bors
commented
Mar 19, 2016
⌛ Testing commit 6f0a130 with merge 8021fa5... |
bors
commented
Mar 19, 2016
💔 Test failed - auto-mac-64-nopt-t |
6f0a130 to
421fed1CompareAmanieu
commented
Mar 19, 2016
Fixed. Note that it seems atomic intrinsics currently don't work on non-integer types, this should be properly fixed at some point... |
alexcrichton
commented
Mar 19, 2016
bors
commented
Mar 19, 2016
⌛ Testing commit 421fed1 with merge 58ca226... |
bors
commented
Mar 19, 2016
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
alexcrichton
commented
Mar 19, 2016
@bors: retry On Sat, Mar 19, 2016 at 12:11 PM, bors notifications@github.com wrote:
|
bors
commented
Mar 19, 2016
Change compare_exchange to return a Result<T, T> As per the discussion in #31767 I also changed the feature name from `extended_compare_and_swap` to `compare_exchange`. r? @alexcrichton
As per the discussion in #31767
I also changed the feature name from
extended_compare_and_swaptocompare_exchange.r? @alexcrichton