TRT
Sign in

Advanced · Module 12 · Lesson 3 of 5

Acquire-Release: Publishing Work Safely

Publish data with release stores and acquire loads so readers observe complete work, and bound concurrency with a three-permit semaphore.

Pro — members onlyAbout 11 minutes

By the end you can

  • Publish shared data with release and acquire ordering
  • Explain why relaxed flags can expose incomplete state
  • Limit concurrent access with a counting semaphore

Builds on std::atomic: Counters and Flags Without Mutexes.

01 · A question first

A producer writes a task record then sets a ready flag. A consumer sees the flag, reads the record, and finds half written fields. The flag itself never tore. What ordering promise was missing between the data write and the flag?

Make a guess before you read on.

02 · The idea

Members only

Unlock the full lesson

This lesson is part of the membership. Join to read it in full, along with every other premium deep dive.

What's inside

  • Start with the problem
  • How the idea works
  • Why it is correct
  • What it costs
  • Pitfalls and variations
  • Where it is used

03 · Practice

Something wrong with this lesson? Report a problem