Skip to content
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

Rewrote the thread struct docs #41543

Merged
merged 3 commits into from May 4, 2017
Merged

Rewrote the thread struct docs #41543

merged 3 commits into from May 4, 2017

Conversation

ghost
Copy link

@ghost ghost commented Apr 25, 2017

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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. Due to 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.

@alexcrichton
Copy link
Member

r? @steveklabnik

Copy link
Member

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

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

Thanks for this! Some changes and a question.

@@ -713,22 +713,27 @@ struct Inner {

#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
/// A handle to a thread.
/// A handle to a thread, its just an abstract reference and as such
Copy link
Member

Choose a reason for hiding this comment

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

"just" is a poor word for docs; this becomes better just dropping it.

Also, this summary is quite long; I think keeping the initial summary is fine, and putting this after:

/// A handle to a thread.
///
/// It is an abstract...

/// A handle to a thread.
/// A handle to a thread, its just an abstract reference and as such
/// it can be used to identify a thread (by name, for example). In most
/// usage cases, this struct is not used directly.
Copy link
Member

Choose a reason for hiding this comment

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

I am not totally sure what you mean by "used directly" here, could you maybe elaborate a bit on what you're thinking?

Copy link
Author

Choose a reason for hiding this comment

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

Well if you print debug most of the examples, those are JoinHandle's really, the threads are inside but you aren't really manipulating Thread structs

/// A handle to a thread.
/// A handle to a thread, its just an abstract reference and as such
/// it can be used to identify a thread (by name, for example). In most
/// usage cases, this struct is not used directly.
///
/// # Examples
///
/// ```
/// use std::thread;
Copy link
Member

Choose a reason for hiding this comment

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

this isn't because of you, but while you're here.... this should be

use std::thread::{self, Builder};

Copy link
Author

Choose a reason for hiding this comment

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

Sure i'll put that :)

/// println!("thread name: {}", thread.name().unwrap());
/// for i in 0..5 {
/// let thread_name = format!("thread_{}", i);
/// thread::Builder::new()
Copy link
Member

Choose a reason for hiding this comment

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

... and then this should be Builder::new()

/// let thread_name = format!("thread_{}", i);
/// thread::Builder::new()
/// .name(thread_name) // Now you can identify which thread panicked
/// // thanks to the handle's name
Copy link
Member

Choose a reason for hiding this comment

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

are these lines wrapped to 80 cols? they look a bit short to me, but that could be wrong!

@aidanhs aidanhs added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 26, 2017
@ghost
Copy link
Author

ghost commented Apr 26, 2017

Ok it is ready :)

@steveklabnik
Copy link
Member

@bors: r+ rollup

thank you!

@bors
Copy link
Contributor

bors commented May 3, 2017

📌 Commit cf52121 has been approved by steveklabnik

@bors
Copy link
Contributor

bors commented May 3, 2017

⌛ Testing commit cf52121 with merge 5320ff0...

@bors
Copy link
Contributor

bors commented May 3, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

@bors: retry

  • seems like a weird travis bug...

@ghost
Copy link
Author

ghost commented May 3, 2017

I was wondering why the powerpc build was taking so long

frewsxcv added a commit to frewsxcv/rust that referenced this pull request May 3, 2017
bors added a commit that referenced this pull request May 3, 2017
Rollup of 6 pull requests

- Successful merges: #41543, #41600, #41715, #41720, #41721, #41730
- Failed merges:
@bors bors merged commit cf52121 into rust-lang:master May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants