-
Notifications
You must be signed in to change notification settings - Fork 69
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
Revisit the memory order used in the WaitQueue
/Waker
/Waiter
#831
Comments
Got an explanation, thanks. |
This is the general practice:
This is the example in this PR:
Locks may not help (unless the critical region includes
So we have to: pub fn is_empty(&self) -> bool {
- self.num_wakers.load(Ordering::Acquire) == 0
+ self.num_wakers.fetch_add(0, Ordering::Release) == 0
} |
For your and others' reference, see the "notes" section in std::atomic_thread_fence, which behaves exactly the same way as
|
asterinas/framework/aster-frame/src/sync/wait.rs
Lines 157 to 159 in 81cca42
Quoted from #828 (comment):
The text was updated successfully, but these errors were encountered: