Skip to content

Enhance documentation on wake call memory ordering#157694

Merged
rust-bors[bot] merged 10 commits into
rust-lang:mainfrom
xmh0511:main
Jun 18, 2026
Merged

Enhance documentation on wake call memory ordering#157694
rust-bors[bot] merged 10 commits into
rust-lang:mainfrom
xmh0511:main

Conversation

@xmh0511

@xmh0511 xmh0511 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 10, 2026
@rustbot

rustbot commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 10 candidates
  • Random selection from LawnGnome, Mark-Simulacrum, clarfonthey, jhpratt

@rust-log-analyzer

This comment has been minimized.

@xmh0511

xmh0511 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@Darksonn

It's probably sufficient to say that "the call to wake() happens-before the beginning of the call to poll()".

the call to wake() sounds like the whole wake() synchronizes with the beginning of the call to poll(). I cited a similar wording in the C++ standard, which is worded in this way:

Synchronization: The completion of the thread represented by *this synchronizes with ([intro.multithread]) the corresponding successful join() return.

I agree that"wake() return" or "the call to wake()" is indistinguishable for establishing happens-before. All evaluations that do not occur within a function invocation are either sequenced-before/after these that occur within the function invocation.

@xmh0511

xmh0511 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@Darksonn After thinking more, I think your wording is reasonable. Consider this a valid implementation of wake(pseudo code)

fn wak(&self){
   do_something1(); // #1
   self.flag.swap(1,AcqRel); // #2
   do_something2(); // #3
}

In this implementation, #2 synchronizes with the RMW operation that is sequenced before the call to poll(). That is, only these evaluations that are sequenced before #2 happen before the poll(). So, strictly speaking, the call expression wake() sequences before #2, it's reasonable to say it happens before the beginning of the call to poll(); however, wake() return does not.

BTW, the expression wake() itself means call to wake, saying call to wake() is a bit strange.

@rust-log-analyzer

This comment has been minimized.

Comment thread library/core/src/task/wake.rs Outdated
Comment thread library/core/src/task/wake.rs Outdated
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
@rust-log-analyzer

This comment has been minimized.

@xmh0511 xmh0511 requested a review from Darksonn June 10, 2026 08:28
Comment thread library/core/src/task/wake.rs Outdated
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
@xmh0511 xmh0511 requested a review from Darksonn June 10, 2026 09:51
Comment thread library/alloc/src/task.rs Outdated
Comment thread library/core/src/task/wake.rs Outdated
Comment thread library/core/src/task/wake.rs Outdated
Comment thread library/core/src/task/wake.rs Outdated
xmh0511 and others added 2 commits June 11, 2026 09:46
Co-authored-by: Kevin Reid <kpreid@switchb.org>
Co-authored-by: Kevin Reid <kpreid@switchb.org>
@xmh0511 xmh0511 requested review from kpreid, lasiotus and orlp June 11, 2026 03:05
Comment thread library/core/src/task/wake.rs Outdated
@Darksonn

Copy link
Copy Markdown
Member

r? @Darksonn

@rustbot rustbot assigned Darksonn and unassigned Mark-Simulacrum Jun 15, 2026
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
@Darksonn

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 42538ca has been approved by Darksonn

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 18, 2026
@Darksonn Darksonn added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. A-async-await Area: Async & Await S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 18, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 18, 2026
Enhance documentation on wake call memory ordering
rust-bors Bot pushed a commit that referenced this pull request Jun 18, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158026 (`RegionValues`: disable unnecessary range check)
 - #156795 (Handle generic reborrow in expression-use adjustment walking)
 - #157694 (Enhance documentation on wake call memory ordering)
 - #158034 (Fix reborrow source expression visits)
 - #158074 (Document transient connection errors from TcpListener::accept)
 - #158086 (renovate: Loosen dashboard approval and adopt recommended config)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 18, 2026
Enhance documentation on wake call memory ordering
rust-bors Bot pushed a commit that referenced this pull request Jun 18, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158026 (`RegionValues`: disable unnecessary range check)
 - #156795 (Handle generic reborrow in expression-use adjustment walking)
 - #157694 (Enhance documentation on wake call memory ordering)
 - #157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - #158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - #158034 (Fix reborrow source expression visits)
 - #158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - #158074 (Document transient connection errors from TcpListener::accept)
 - #158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - #158086 (renovate: Loosen dashboard approval and adopt recommended config)
rust-bors Bot pushed a commit that referenced this pull request Jun 18, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158026 (`RegionValues`: disable unnecessary range check)
 - #156795 (Handle generic reborrow in expression-use adjustment walking)
 - #157694 (Enhance documentation on wake call memory ordering)
 - #157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - #158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - #158034 (Fix reborrow source expression visits)
 - #158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - #158074 (Document transient connection errors from TcpListener::accept)
 - #158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - #158086 (renovate: Loosen dashboard approval and adopt recommended config)
rust-bors Bot pushed a commit that referenced this pull request Jun 18, 2026
Rollup of 12 pull requests

Successful merges:

 - #156795 (Handle generic reborrow in expression-use adjustment walking)
 - #157694 (Enhance documentation on wake call memory ordering)
 - #157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - #158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - #158009 (Reject `impl const Trait` since the right syntax is `const impl Trait` now)
 - #158034 (Fix reborrow source expression visits)
 - #158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - #158074 (Document transient connection errors from TcpListener::accept)
 - #158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - #158086 (renovate: Loosen dashboard approval and adopt recommended config)
 - #158088 (codegen_ssa: no dbginfo for scalable vec local w/ `-O0`)
 - #158089 (Fix invalid "jump-to-def" doc link generation when an item has a `derive` proc-macro)
@rust-bors rust-bors Bot merged commit 6244e91 into rust-lang:main Jun 18, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 18, 2026
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Jun 19, 2026
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#156795 (Handle generic reborrow in expression-use adjustment walking)
 - rust-lang/rust#157694 (Enhance documentation on wake call memory ordering)
 - rust-lang/rust#157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - rust-lang/rust#158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - rust-lang/rust#158009 (Reject `impl const Trait` since the right syntax is `const impl Trait` now)
 - rust-lang/rust#158034 (Fix reborrow source expression visits)
 - rust-lang/rust#158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - rust-lang/rust#158074 (Document transient connection errors from TcpListener::accept)
 - rust-lang/rust#158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - rust-lang/rust#158086 (renovate: Loosen dashboard approval and adopt recommended config)
 - rust-lang/rust#158088 (codegen_ssa: no dbginfo for scalable vec local w/ `-O0`)
 - rust-lang/rust#158089 (Fix invalid "jump-to-def" doc link generation when an item has a `derive` proc-macro)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-async-await Area: Async & Await A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants