You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-15 13:50:27 +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:
@ -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>
|
||||
|
Reference in New Issue
Block a user