This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
library/std/src/sys/itron Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,9 @@ impl Thread {
151151 // Since the parent might drop `*inner` and terminate us as
152152 // soon as it sees `JOIN_FINALIZE`, the release ordering
153153 // 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.
154157
155158 // [JOINING → JOIN_FINALIZE]
156159 // Wake up the parent task.
@@ -218,11 +221,15 @@ impl Thread {
218221
219222 let current_task = current_task as usize ;
220223
221- match inner. lifecycle . swap ( current_task, Ordering :: Acquire ) {
224+ match inner. lifecycle . swap ( current_task, Ordering :: AcqRel ) {
222225 LIFECYCLE_INIT => {
223226 // [INIT → JOINING]
224227 // The child task will transition the state to `JOIN_FINALIZE`
225228 // 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.
226233 loop {
227234 expect_success_aborting ( unsafe { abi:: slp_tsk ( ) } , & "slp_tsk" ) ;
228235 // To synchronize with the child task's memory accesses to
You can’t perform that action at this time.
0 commit comments