Skip to content

Commit 708da3e

Browse files
authoredFeb 22, 2017
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
2 parents 7e544c2 + 689dc26 commit 708da3e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/libstd/thread/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub use self::local::{LocalKey, LocalKeyState};
235235
pub struct Builder {
236236
// A name for the thread-to-be, for identification in panic messages
237237
name: Option<String>,
238-
// The size of the stack for the spawned thread
238+
// The size of the stack for the spawned thread in bytes
239239
stack_size: Option<usize>,
240240
}
241241

@@ -289,14 +289,17 @@ impl Builder {
289289
self
290290
}
291291

292-
/// Sets the size of the stack for the new thread.
292+
/// Sets the size of the stack (in bytes) for the new thread.
293+
///
294+
/// The actual stack size may be greater than this value if
295+
/// the platform specifies minimal stack size.
293296
///
294297
/// # Examples
295298
///
296299
/// ```
297300
/// use std::thread;
298301
///
299-
/// let builder = thread::Builder::new().stack_size(10);
302+
/// let builder = thread::Builder::new().stack_size(32 * 1024);
300303
/// ```
301304
#[stable(feature = "rust1", since = "1.0.0")]
302305
pub fn stack_size(mut self, size: usize) -> Builder {

0 commit comments

Comments
 (0)
Please sign in to comment.