File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -119,10 +119,17 @@ A few things to note:
119119 ` data ` must be copied or cloned (depending on what the type of the value
120120 supports).
121121
122+ Since Rust 1.63.0, it is possible to use [ scoped threads] to use non-static data
123+ (including references to not-` move ` d values) in threads. The trade-off is that
124+ since the data must remain alive until the thread's end, it is forcibly joined
125+ by the end of the scope.
126+
122127- Rust thread can return values, like tasks in C#, which becomes the return
123128 value of the ` join ` method.
124129
125130- It is possible to also pass data to the C# thread via a closure, like the
126131 Rust example, but the C# version does not need to worry about ownership
127132 since the memory behind the data will be reclaimed by the GC once no one is
128133 referencing it anymore.
134+
135+ [ scoped threads ] : https://doc.rust-lang.org/stable/std/thread/fn.scope.html
You can’t perform that action at this time.
0 commit comments