LearnFrenzy
Sign in Take a free test

Multithreading · Multithreading MCQ · Question 11

When is std::atomic enough? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

When is std::atomic a good replacement for a mutex?

  • A When several variables must change together
  • B For a single independent counter or flag Correct
  • C For protecting a std::map
  • D Never
Correct Answer: Option B

Two atomics updated one after the other are not one atomic operation.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links