Code Room
Code reviewHard
Question
Review this C++ publish/consume flag pattern.
The atomic is there so it must be fine, right?
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
int payload = 0;std::atomic<bool> ready{false}; void producer() { payload = compute(); // (1) plain store ready.store(true, std::memory_order_relaxed); // (2)} void consumer() { while (!ready.load(std::memory_order_relaxed)) {} // (3) spin use(payload); // (4)}Run or narrate your approach, then ask the coach.