Skip to content
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

Is there any difference between SeqCst store and SeqCst fence after a Relaxed store? #977

Open
MrCroxx opened this issue Apr 24, 2023 · 1 comment

Comments

@MrCroxx
Copy link

MrCroxx commented Apr 24, 2023

Hi team, I'm currently learning the source code of the cool crossbeam-epoch and I found some questions.

When marking the global epoch as pinned, a SeqCst memory-ordered store operation is needed. I found in crossbeam-epoch it first performed a Relaxed store then send a SeqCst fence manually. Is there any difference between just using a SeqCst store here?

self.epoch.store(new_epoch, Ordering::Relaxed);
atomic::fence(Ordering::SeqCst);

@zhangzhuang15
Copy link

I guess that it only works for 'epoch' variable:

self.epoch.store(new_epoch, Ordering::SeqCst);

But it also works other variables which adapt "Ordering::SeqCst" by using fence of "Ordering::SeqCst"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants