Skip to content

Commit

Permalink
Rollup merge of rust-lang#40030 - matklad:stack-docs, r=alexcrichton
Browse files Browse the repository at this point in the history
Clarify thread::Builder::stack_size docs

Add two pieces of information:

* the size is in bytes
* the actual stack size might be bigger.

Also change the example to use a more realistic value of 32 kilobytes.

r? @steveklabnik
  • Loading branch information
GuillaumeGomez authored Feb 23, 2017
2 parents 178355f + 689dc26 commit dcd5c55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/libstd/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ pub use self::local::{LocalKey, LocalKeyState};
pub struct Builder {
// A name for the thread-to-be, for identification in panic messages
name: Option<String>,
// The size of the stack for the spawned thread
// The size of the stack for the spawned thread in bytes
stack_size: Option<usize>,
}

Expand Down Expand Up @@ -289,14 +289,17 @@ impl Builder {
self
}

/// Sets the size of the stack for the new thread.
/// Sets the size of the stack (in bytes) for the new thread.
///
/// The actual stack size may be greater than this value if
/// the platform specifies minimal stack size.
///
/// # Examples
///
/// ```
/// use std::thread;
///
/// let builder = thread::Builder::new().stack_size(10);
/// let builder = thread::Builder::new().stack_size(32 * 1024);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn stack_size(mut self, size: usize) -> Builder {
Expand Down

0 comments on commit dcd5c55

Please sign in to comment.