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 it necessary to use cmpxchg when clear a bit of MaskAndCount? #74

Open
lastweek opened this issue Jul 4, 2019 · 0 comments
Open

Comments

@lastweek
Copy link

lastweek commented Jul 4, 2019

Hi,

Quick question about MaskAndCount.

It could be read by multiple threads concurrently, thus a final compare_and_swap is necessary to guarantee atomicity.

But is it only being cleared by one single thread (the one who owns it)? If so, it seems a simple atomic clear_bit() is enough rather than full-fledged cmpxchg. Related code here.

@lastweek lastweek changed the title About MaskAndCount Is it necessary to use cmpxchg when clear a bit of MaskAndCount? Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant