You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/trpl/concurrency.md
+2-9Lines changed: 2 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -223,15 +223,8 @@ method which has this signature:
223
223
fn lock(&self) -> LockResult<MutexGuard<T>>
224
224
```
225
225
226
-
If we [look at the code for MutexGuard](https://github.com/rust-lang/rust/blob/ca4b9674c26c1de07a2042cb68e6a062d7184cef/src/libstd/sync/mutex.rs#L172), we'll see
227
-
this:
228
-
229
-
```ignore
230
-
__marker: marker::NoSend,
231
-
```
232
-
233
-
Because our guard is `NoSend`, it's not `Send`. Which means we can't actually
234
-
transfer the guard across thread boundaries, which gives us our error.
226
+
Because `Send` is not implemented for `MutexGuard<T>`, we can't transfer the
227
+
guard across thread boundaries, which gives us our error.
235
228
236
229
We can use `Arc<T>` to fix this. Here's the working version:
0 commit comments