diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-09-12 20:02:10 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-12 20:02:10 +1000 |
| commit | 1037c082bc7d3ccd803b3eb0d48fc7fd81ddc733 (patch) | |
| tree | 3c186fdc3a82e66ac44ecdf9ce92aab3df9f3976 /library/std/src/sys | |
| parent | 48d684111e462b1ff600728b9a816520a4f3276a (diff) | |
| parent | 39d51d04e706dee462ac4a17508ed87eb52e7715 (diff) | |
Rollup merge of #145895 - RalfJung:unpark, r=joboet
thread parking: fix docs and examples Fixes https://github.com/rust-lang/rust/issues/145816 r? ```@joboet``` Cc ```@m-ou-se``` ```@Amanieu```
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/sync/once/queue.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/sys/sync/once/queue.rs b/library/std/src/sys/sync/once/queue.rs index 49e15d65f25..17d99cdb385 100644 --- a/library/std/src/sys/sync/once/queue.rs +++ b/library/std/src/sys/sync/once/queue.rs @@ -276,7 +276,9 @@ fn wait( // If the managing thread happens to signal and unpark us before we // can park ourselves, the result could be this thread never gets // unparked. Luckily `park` comes with the guarantee that if it got - // an `unpark` just before on an unparked thread it does not park. + // an `unpark` just before on an unparked thread it does not park. Crucially, we know + // the `unpark` must have happened between the `compare_exchange_weak` above and here, + // and there's no other `park` in that code that could steal our token. // SAFETY: we retrieved this handle on the current thread above. unsafe { node.thread.park() } } |
