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

Memory ordering for atomically swapped pointers #20

Open
vanrein opened this issue Jun 10, 2022 · 0 comments
Open

Memory ordering for atomically swapped pointers #20

vanrein opened this issue Jun 10, 2022 · 0 comments

Comments

@vanrein
Copy link

vanrein commented Jun 10, 2022

I use OPA to atomically handle pointer put/get/swap operations. The data pointed at was written before putting it, and read after getting it, of course.

I investigated memory barriers, and am confused about whether OPA handles these, or not. There are barriers in the include files, but for pointers it is not clear whether they apply to the pointer alone, or to the data referenced.

It almost always makes sense to handle memory order issues for all pointer operations. The one exception is when code handles the pointer alone (which I've encountered in the example I point at).

  1. Is it right that OPA does not handle memory ordering of swaps that are being pointed-at?
  2. Is it an idea to add primitives that clearly help users to portable memory barriers for pointers used via OPA?
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