-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Notify uses SeqCst orderings, but acquire/release is enough #6266
Comments
There is precedent for this in #6018, so I guess I am okay with a PR. |
Does the suggested ordering for the atomic operations seem reasonable? If it is, I'll proceed with submitting a pull request right away. |
Acquire/release is probably correct in most places, but I'd have to look at the specific code to know for sure. |
I'm slightly uncertain about the usage of the following three compare_exchange operations. Based on my detection pattern, it's possible that the code doesn't require the use of AcqRel.
Perhaps the ordering for these two operations should use AcqRel and Acquire? As for the other orderings, I believe they are reasonable as is😁. |
You can add AcqRel for now and I will review whether it is necessary or not. |
I developed a static analysis tool to detect issues related to memory ordering, thread performance, and security. During my examination of several crates, I encountered alarms triggered by the following code:
I believe the ordering explained in the diagnosis is valid, particularly concerning the following atomic operations in the code:
tokio/tokio/src/sync/notify.rs
Line 570 in 46ff363
tokio/tokio/src/sync/notify.rs
Lines 932 to 937 in 46ff363
tokio/tokio/src/sync/notify.rs
Line 643 in 46ff363
tokio/tokio/src/sync/notify.rs
Line 586 in 46ff363
tokio/tokio/src/sync/notify.rs
Lines 949 to 954 in 46ff363
tokio/tokio/src/sync/notify.rs
Lines 896 to 901 in 46ff363
tokio/tokio/src/sync/notify.rs
Line 1037 in 46ff363
(happy to make a PR if this looks reasonable)
The text was updated successfully, but these errors were encountered: