Ordering::AcqRel
This variant is a combination of Acquire and Release. When a load is performed with AcqRel, then Acquire is used, and stored to Release. AcqRel is not just a convenience in that it combines the ordering behaviors of both Acquire and Release—the ordering is porous on neither side. That is, loads and stores after an AcqRel cannot move up, as with Acquire, and loads and stores prior to an AcqRel cannot move down, as with Release. Nifty trick.
Before moving on to the next ordering variation, it's worth pointing out that so far we've only seen examples of a thread performing an Acquire/Release in a pair, in cooperation with another thread. It doesn't have to be this way. One thread can always perform Acquire and another can always ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access