Skip to content

Conversation

andylamp
Copy link

@andylamp andylamp commented Jan 3, 2016

The wording (and example) are quite vague; this is an attempt to clarify both the wording as well as provide a more concise example.

Copy link
Member

Choose a reason for hiding this comment

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

space needed between /// and ``compare`

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't read right to me. 'the previous value contained in the pointer' sounds to me like it's not returning a pointer but a value type. 'If it is equal to the value pointed by current sounds similarly misleading. It's not actually true that if the value pointer to be current is the same as the value pointed to be the return value then the pointer was updated. What matters is the value of the pointer itself (the address). It's possible for current and new to point to two different values that are still equal - those values don't have any affect on what the CAS is doing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here's my attempt.

"Stores the new pointer into the AtomicPtr if the presently contained pointer is the same as the address pointed to by the current argument.

The return value is always the previous contained pointer. If its value (the address it points to) is the same as current then the pointer was updated."

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd still like the wording to be refined here per my previous comments. Might also be good to have some more eyes on this, since it's hard to phrase well with the distinctions between different pointers and values being made. cc @rust-lang/libs

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with comments addressed!

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.

6 participants