File tree 1 file changed +8
-1
lines changed
library/std/src/sys/itron
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,9 @@ impl Thread {
151
151
// Since the parent might drop `*inner` and terminate us as
152
152
// soon as it sees `JOIN_FINALIZE`, the release ordering
153
153
// must be used in the above `swap` call.
154
+ //
155
+ // To make the task referred to by `parent_tid` visible, we
156
+ // must use the acquire ordering in the above `swap` call.
154
157
155
158
// [JOINING → JOIN_FINALIZE]
156
159
// Wake up the parent task.
@@ -218,11 +221,15 @@ impl Thread {
218
221
219
222
let current_task = current_task as usize ;
220
223
221
- match inner. lifecycle . swap ( current_task, Ordering :: Acquire ) {
224
+ match inner. lifecycle . swap ( current_task, Ordering :: AcqRel ) {
222
225
LIFECYCLE_INIT => {
223
226
// [INIT → JOINING]
224
227
// The child task will transition the state to `JOIN_FINALIZE`
225
228
// and wake us up.
229
+ //
230
+ // To make the task referred to by `current_task` visible from
231
+ // the child task's point of view, we must use the release
232
+ // ordering in the above `swap` call.
226
233
loop {
227
234
expect_success_aborting ( unsafe { abi:: slp_tsk ( ) } , & "slp_tsk" ) ;
228
235
// To synchronize with the child task's memory accesses to
You can’t perform that action at this time.
0 commit comments