diff options
| author | Ralf Jung <post@ralfj.de> | 2025-08-26 18:12:36 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-09-03 09:14:25 +0200 |
| commit | 39d51d04e706dee462ac4a17508ed87eb52e7715 (patch) | |
| tree | 6a8aaabd8164f0c687d53f9a3b2735c0945873ff /library/std/src/sys/sync | |
| parent | 5ab69249f36678c0a770a08d3d1b28a8103349ff (diff) | |
| download | rust-39d51d04e706dee462ac4a17508ed87eb52e7715.tar.gz rust-39d51d04e706dee462ac4a17508ed87eb52e7715.zip | |
thread parking: fix docs and examples
Diffstat (limited to 'library/std/src/sys/sync')
| -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() } } |
