mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-05 16:10:31 +02:00
Update scoped-threads.md (#253)
Adding speaker notes explaining why scoped threads work and what borrowing rules apply.
This commit is contained in:
parent
77a60d4101
commit
8107a0ea2b
@ -31,3 +31,10 @@ fn main() {
|
||||
```
|
||||
|
||||
[1]: https://doc.rust-lang.org/std/thread/fn.scope.html
|
||||
|
||||
<details>
|
||||
|
||||
* The reason for that is that when the `thread::scope` function completes, all the threads are guaranteed to be joined, so they can return borrowed data.
|
||||
* Normal Rust borrowing rules apply: you can either borrow mutably by one thread, or immutably by any number of threads.
|
||||
|
||||
</details>
|
||||
|
Loading…
Reference in New Issue
Block a user