From d112274fcb7175248a42c3b83382835710558cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Thu, 20 Aug 2015 21:50:20 +0100 Subject: [PATCH] Use handle the same way in similarly structured examples --- src/doc/trpl/concurrency.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/doc/trpl/concurrency.md b/src/doc/trpl/concurrency.md index 17627da3513e..e00fe75013e2 100644 --- a/src/doc/trpl/concurrency.md +++ b/src/doc/trpl/concurrency.md @@ -343,12 +343,14 @@ threads as a simple isolation mechanism: ```rust use std::thread; -let result = thread::spawn(move || { +let handle = thread::spawn(move || { panic!("oops!"); -}).join(); +}); + +let result = handle.join(); assert!(result.is_err()); ``` -Our `Thread` gives us a `Result` back, which allows us to check if the thread +`Thread.join()` gives us a `Result` back, which allows us to check if the thread has panicked or not.