Skip to content

Use handle.join() the same way in similarly structured examples #27924

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

Conversation

kornelski
Copy link
Contributor

The chapter on concurrency has two examples that both start with:

 let something = thread::spawn(…

but the returned values have different types, because the second example has .join() at the end of the expression.

I haven't noticed that join at first, and was wondering how is that possible that the result can have .is_err() and .join() methods.

I've changed the second example to have the same structure as the first, so they're easy to compare.

@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 the contribution instructions for more information.


assert!(result.is_err());
assert!(handle.join().is_err());
Copy link
Member

Choose a reason for hiding this comment

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

I would actually prefer if we moved this join() out, instead: joining in an assert! feels very...strange.

Copy link
Member

Choose a reason for hiding this comment

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

(like, add a line above with let result = handle.join() and then assert! on result.is_err().

@kornelski
Copy link
Contributor Author

Changed & squashed.

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 22, 2015

📌 Commit d112274 has been approved by steveklabnik

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 22, 2015
The chapter on concurrency has two examples that both start with:

     let something = thread::spawn(…

but the returned values have different types, because the second example has `.join()` at the end of the expression.

I haven't noticed that join at first, and was wondering how is that possible that the result can have `.is_err()` and `.join()` methods.

I've changed the second example to have the same structure as the first, so they're easy to compare.
bors added a commit that referenced this pull request Aug 23, 2015
@bors bors merged commit d112274 into rust-lang:master Aug 23, 2015
@kornelski kornelski deleted the bookthreadjoin branch August 23, 2015 12:57
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.

4 participants