Atomic And Still Wrong
// snippet A, run by two threads
std::atomic<int> balance{50};
if (balance.load() >= 50)
balance.fetch_sub(50);
// snippet B, run by two threads
int counter = 0;
counter++;
Classify each.
Sign in to answer questions and track your progress
Sign In