Skip to content

Tweaked concurrency.md #27503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2015
Merged

Tweaked concurrency.md #27503

merged 1 commit into from
Aug 5, 2015

Conversation

c-nixon
Copy link
Contributor

@c-nixon c-nixon commented Aug 3, 2015

I was reading through the docs and came across a section that felt awkward.

I've tried to improve the flow by splitting up and reversing the explanations of
Arc and Mutex with some example code in between.

The "This would have have happened" bit is unfortunate but I couldn't see any
other way to illustrate it. The compiler errors didn't really help tell the
story in this particular instance so it still feels a bit forced. However I do think it's
an a small improvement...

Does anyone have any other ideas that might flow better?

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@brson
Copy link
Contributor

brson commented Aug 3, 2015

r? @steveklabnik

@rust-highfive rust-highfive assigned steveklabnik and unassigned brson Aug 3, 2015
it's actually not safe: if we had a reference to `data` in each thread, and the
thread takes ownership of the reference, we have three owners! That's bad. We
can fix this by using the `Arc<T>` type, which is an atomic reference counted
pointer. The 'atomic' part means that it's safe to share across threads.
Copy link
Member

Choose a reason for hiding this comment

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

this revision seems to lose the 'atomic' explanation, which is especially important given that Swift means something else by Arc

@steveklabnik
Copy link
Member

I like these changes, but want to retain the 'atomic' explanation, can we bring that back?

Also, yeah, the 'would have' is kind of awkward, but I still think this is better. Thanks so much!

@c-nixon c-nixon force-pushed the master branch 2 times, most recently from 0b0054d to 9253204 Compare August 4, 2015 07:48
@c-nixon
Copy link
Contributor Author

c-nixon commented Aug 4, 2015

I've updated the pull request. How's it look now?

I originally had a full exposition on Reference counting and Atomic operations but decided to strip it out for brevity's sake since "Atomic Reference Count" is mentioned at the top of the file in the explanation of Sync.

However I can definitely see how it's useful to have it explained near the code that uses it.

@bors
Copy link
Collaborator

bors commented Aug 4, 2015

☔ The latest upstream changes (presumably #27508) made this pull request unmergeable. Please resolve the merge conflicts.

@steveklabnik
Copy link
Member

Looks good. r=me after a rebase, due to @bors

@bors
Copy link
Collaborator

bors commented Aug 4, 2015

📌 Commit 9253204 has been approved by me

@steveklabnik
Copy link
Member

@bors: r-

@c-nixon
Copy link
Contributor Author

c-nixon commented Aug 4, 2015

That's it rebased, thanks for the feedback!

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 4, 2015

📌 Commit d5b522e has been approved by steveklabnik

@bors
Copy link
Collaborator

bors commented Aug 5, 2015

⌛ Testing commit d5b522e with merge 76ff835...

bors added a commit that referenced this pull request Aug 5, 2015
I was reading through the docs and came across a section that felt awkward.

I've tried to improve the flow by splitting up and reversing the explanations of
Arc and Mutex with some example code in between.

The "This would have have happened" bit is unfortunate but I couldn't see any
other way to illustrate it. The compiler errors didn't really help tell the
story in this particular instance so it still feels a bit forced. However I do think it's
an a small improvement...

Does anyone have any other ideas that might flow better?
@bors bors merged commit d5b522e into rust-lang:master Aug 5, 2015
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.

5 participants