This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 2d4415d
authored
Unrolled build for rust-lang#131746
Rollup merge of rust-lang#131746 - slanterns:once_box_order, r=joboet
Relax a memory order in `once_box`
per rust-lang#131094 (comment).
In the successful path we don't need `Acquire` since we don't care if the store in `f()` happened in other threads has become visible to the current thread. We'll use our own results instead and just using `Release` to ensure other threads can see our store to `Box` when they fail the `compare_exchange` will suffice.
Also took https://marabos.nl/atomics/memory-ordering.html#example-lazy-initialization-with-indirection as a reference.
`@rustbot` label: +T-libs
r? `@ibraheemdev`1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments