about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-02-24 13:22:57 +0100
committerGitHub <noreply@github.com>2017-02-24 13:22:57 +0100
commitef4d27d4599edf080686f4800e8f6170ac48ae4d (patch)
tree4b8f0e977098d5ece6c250f814f538783428a821 /src/libstd
parent94a3172891670cb480dec7c3337517bfe0d8d4dd (diff)
parent689dc26b685fb88993e055c4c2155b9a4b2c3797 (diff)
downloadrust-ef4d27d4599edf080686f4800e8f6170ac48ae4d.tar.gz
rust-ef4d27d4599edf080686f4800e8f6170ac48ae4d.zip
Rollup merge of #40030 - matklad:stack-docs, r=alexcrichton
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
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/thread/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 93e320c4522..2bc066d3fea 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -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>,
 }
 
@@ -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 {