From 63d9ed847874d4457256365e7a265ea0ef224a34 Mon Sep 17 00:00:00 2001 From: jw013 Date: Wed, 22 May 2024 05:00:24 -0400 Subject: [PATCH] Update 04_scoped_threads.md (#21) Fix incorrect statement and remove unintended line break. --- book/src/07_threads/04_scoped_threads.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/src/07_threads/04_scoped_threads.md b/book/src/07_threads/04_scoped_threads.md index 6308091..c8b69e7 100644 --- a/book/src/07_threads/04_scoped_threads.md +++ b/book/src/07_threads/04_scoped_threads.md @@ -65,9 +65,9 @@ that `&v` can't be used from our spawned threads since its lifetime isn't That's not an issue with `std::thread::scope`—you can **safely borrow from the environment**. -In our example, `v` is created before the spawning points. +In our example, `v` is created before the spawning points. It will only be dropped _after_ `scope` returns. At the same time, -all threads spawned inside `scope` are guaranteed `v` is dropped, +all threads spawned inside `scope` are guaranteed to finish _before_ `scope` returns, therefore there is no risk of having dangling references. -The compiler won't complain! \ No newline at end of file +The compiler won't complain! -- 2.45.2