Skip to content

Update intro.md to fix thread spawning example Closes #22419 #22514

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
Feb 23, 2015

Conversation

diamondman
Copy link
Contributor

Fixed example threaded code in intro doc never printing results. Threads were created with Thread::spawn instead of Thread::scoped. Also added correct thread handling like in the first example of the document.

@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 @steveklabnik (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 CONTRIBUTING.md for more information.

@steveklabnik
Copy link
Member

@bors: r+ c2600cf rollup

@steveklabnik
Copy link
Member

Thank you!

@diamondman
Copy link
Contributor Author

What does the rollup command mean?

@steveklabnik
Copy link
Member

Here's the patch queue: http://buildbot.rust-lang.org/homu/queue/rust

basically, it means that this is a low-impact change that's not likely to fail the tests. we mark any PRs that feel right as rollups, and then, when any rollup commit gets built or we kick one off manually, they all get done at once.

@Manishearth
Copy link
Member

(needs rebase)

@diamondman
Copy link
Contributor Author

I am not sure to tell what the conflict was because of how the branches are rolled together through a rollup.

@Manishearth
Copy link
Member

It's 8c34b26, Niko removed us/is suffixes

diff --git a/src/doc/intro.md b/src/doc/intro.md
index 90a018c..d9bfe71 100644
--- a/src/doc/intro.md
+++ b/src/doc/intro.md
@@ -480,7 +480,7 @@ use std::sync::{Arc,Mutex};
 fn main() {
     let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));

-    for i in 0us..3 {
+    for i in 0..3 {
         let number = numbers.clone();
         Thread::spawn(move || {
             let mut array = number.lock().unwrap();
@@ -541,7 +541,7 @@ use std::thread::Thread;
 fn main() {
     let vec = vec![1, 2, 3];

-    for i in 0us..3 {
+    for i in 0..3 {
         Thread::spawn(move || {
             println!("{}", vec[i]);
         });

Generally I don't hunt down merge conflicts, I just git fetch origin; git rebase -i origin/master, and use git mergetool (I prefer meld personally) to fix them -- this way you get a focused view of conflicting files and tools to fix the conflicts.

@diamondman
Copy link
Contributor Author

Would I not have to pull the newest master and then merge each of the branches that are in the roll up manually and then see which one has a conflict? And will I be able to fix this conflict since it is in someone else's fork?

@steveklabnik
Copy link
Member

@diamondman the issue is that it doesn't build against master, not other rollup PRs. in general, the rollup is a thing you shouldn't have to worry about.

@Manishearth
Copy link
Member

No. All the changes from the rollup are on master.

The conflict is between your branch and master.

@Manishearth
Copy link
Member

(To be fair, when I notice that there is a conflict with a not-yet-merged rollup I'll either fix it myself or notify the author, but then I give sufficient details)

@Manishearth
Copy link
Member

Also, as mentioned before, it's far easier using rebase/mergetool and letting Git do most of the work for you :)

@diamondman
Copy link
Contributor Author

diamondman commented Feb 22, 2015 via email

Fixed example threaded code in intro doc never printing results. Threads were created with Thread::spawn instead of Thread::scoped.
@Manishearth
Copy link
Member

@bors: r=steveklabnik 6154c88 rollup

bombless added a commit to bombless/rust that referenced this pull request Feb 23, 2015
…teveklabnik

Fixed example threaded code in intro doc never printing results. Threads were created with Thread::spawn instead of Thread::scoped. Also added correct thread handling like in the first example of the document.
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 23, 2015
…teveklabnik

 Fixed example threaded code in intro doc never printing results. Threads were created with Thread::spawn instead of Thread::scoped. Also added correct thread handling like in the first example of the document.
@alexcrichton alexcrichton merged commit 6154c88 into rust-lang:master Feb 23, 2015
@diamondman diamondman deleted the intro_doc_threading branch February 24, 2015 05:09
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