kmc-solid: Synchronize with the read when sending a joining task ID to a joinee
This commit is contained in:
parent
304c6dcaed
commit
6fbef06f26
1 changed files with 8 additions and 1 deletions
|
@ -151,6 +151,9 @@ impl Thread {
|
||||||
// Since the parent might drop `*inner` and terminate us as
|
// Since the parent might drop `*inner` and terminate us as
|
||||||
// soon as it sees `JOIN_FINALIZE`, the release ordering
|
// soon as it sees `JOIN_FINALIZE`, the release ordering
|
||||||
// must be used in the above `swap` call.
|
// must be used in the above `swap` call.
|
||||||
|
//
|
||||||
|
// To make the task referred to by `parent_tid` visible, we
|
||||||
|
// must use the acquire ordering in the above `swap` call.
|
||||||
|
|
||||||
// [JOINING → JOIN_FINALIZE]
|
// [JOINING → JOIN_FINALIZE]
|
||||||
// Wake up the parent task.
|
// Wake up the parent task.
|
||||||
|
@ -218,11 +221,15 @@ impl Thread {
|
||||||
|
|
||||||
let current_task = current_task as usize;
|
let current_task = current_task as usize;
|
||||||
|
|
||||||
match inner.lifecycle.swap(current_task, Ordering::Acquire) {
|
match inner.lifecycle.swap(current_task, Ordering::AcqRel) {
|
||||||
LIFECYCLE_INIT => {
|
LIFECYCLE_INIT => {
|
||||||
// [INIT → JOINING]
|
// [INIT → JOINING]
|
||||||
// The child task will transition the state to `JOIN_FINALIZE`
|
// The child task will transition the state to `JOIN_FINALIZE`
|
||||||
// and wake us up.
|
// and wake us up.
|
||||||
|
//
|
||||||
|
// To make the task referred to by `current_task` visible from
|
||||||
|
// the child task's point of view, we must use the release
|
||||||
|
// ordering in the above `swap` call.
|
||||||
loop {
|
loop {
|
||||||
expect_success_aborting(unsafe { abi::slp_tsk() }, &"slp_tsk");
|
expect_success_aborting(unsafe { abi::slp_tsk() }, &"slp_tsk");
|
||||||
// To synchronize with the child task's memory accesses to
|
// To synchronize with the child task's memory accesses to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue