Skip to content

Commit d112274

Browse files
committed
Use handle the same way in similarly structured examples
1 parent aca2057 commit d112274

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/doc/trpl/concurrency.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,14 @@ threads as a simple isolation mechanism:
343343
```rust
344344
use std::thread;
345345

346-
let result = thread::spawn(move || {
346+
let handle = thread::spawn(move || {
347347
panic!("oops!");
348-
}).join();
348+
});
349+
350+
let result = handle.join();
349351

350352
assert!(result.is_err());
351353
```
352354

353-
Our `Thread` gives us a `Result` back, which allows us to check if the thread
355+
`Thread.join()` gives us a `Result` back, which allows us to check if the thread
354356
has panicked or not.

0 commit comments

Comments
 (0)