LearnFrenzy
Sign in Take a free test

Multithreading · Multithreading MCQ · Question 19

std::latch versus std::barrier Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 19 Back to Exercise

What is the difference between C++20 std::latch and std::barrier?

  • A None
  • B A latch counts down once and cannot be reused; a barrier resets after each phase so threads can meet repeatedly Correct
  • C A barrier counts up
  • D A latch is a mutex
Correct Answer: Option B

A barrier can also run a completion function at the end of each phase.

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