Skip to content

Memory ordering for atomically swapped pointers #20

@vanrein

Description

@vanrein

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions