Code Room
Code reviewHard
Question
Review this C++ lock-free free-list. `pop` hands out a node; `push` returns one. Multiple threads call both.
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
std::atomic<Node*> head; Node* pop() { Node* old = head.load(); while (old && !head.compare_exchange_weak(old, old->next)) {} return old;} void push(Node* n) { n->next = head.load(); while (!head.compare_exchange_weak(n->next, n)) {}}Run or narrate your approach, then ask the coach.