From: LukeMathWalker <20745048+LukeMathWalker@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:53:53 +0000 (+0200) Subject: Reword 'static issues. Closes #117 X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=be5c0e8bae8d478e1b9cc6029dfe5b98e161d562;p=rust_exercises.git Reword 'static issues. Closes #117 --- diff --git a/book/src/07_threads/10_patch.md b/book/src/07_threads/10_patch.md index db081e9..58257e9 100644 --- a/book/src/07_threads/10_patch.md +++ b/book/src/07_threads/10_patch.md @@ -10,9 +10,9 @@ In the non-threaded version of the system, updates were fairly straightforward: ## Multithreaded updates -The same strategy won't work in the current multi-threaded version, -because the mutable reference would have to be sent over a channel. The borrow checker would -stop us, because `&mut Ticket` doesn't satisfy the `'static` lifetime requirement of `SyncSender::send`. +The same strategy won't work in the current multithreaded version. The borrow checker would +stop us: `SyncSender<&mut Ticket>` isn't `'static` because `&mut Ticket` doesn't satisfy the `'static` lifetime, therefore +they can't be captured by the closure that gets passed to `std::thread::spawn`. There are a few ways to work around this limitation. We'll explore a few of them in the following exercises.