Skip to content

A release store operation synchronizes with an acquire load operation instead of the reverse #132892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xmh0511 opened this issue Nov 11, 2024 · 2 comments
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Nov 11, 2024

Location

In the document park

Calls to park synchronize-with calls to unpark, meaning that memory operations performed before a call to unpark are made visible to the thread that consumes the token and returns from park.

In atomic ordering terms, unpark performs a Release operation and park performs the corresponding Acquire operation. Calls to unpark for the same thread form a release sequence.

Since the memory order in Rust is from C++, in C++ standard, [atomics.order] p2 says:

An atomic operation A that performs a release operation on an atomic object M synchronizes with an atomic operation B that performs an acquire operation on M and takes its value from any side effect in the release sequence headed by A.

Since unpark performs a Release operation and park performs the corresponding Acquire operation, by the definition of the wording synchronizes with, we should say

calls to unpark synchronize-with calls to park.

Summary

calls to unpark synchronize-with calls to park.

because a release store operation synchronize with an acquire load operation

@xmh0511 xmh0511 added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Nov 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 11, 2024
@jieyouxu jieyouxu added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 11, 2024
@Noratrieb
Copy link
Member

makes sense, feel free to make a PR

@xmh0511
Copy link
Contributor Author

xmh0511 commented Nov 12, 2024

#132937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants