LearnFrenzy
Sign in Take a free test

Multithreading · Multithreading MCQ · Question 15

Exceptions thrown inside std::async tasks Answer, explanation & discussion

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

A function run with std::async throws. What happens?

  • A The program terminates
  • B The exception is stored in the future and rethrown by get() Correct
  • C It is silently ignored
  • D The thread restarts
Correct Answer: Option B

An exception escaping a plain std::thread function, by contrast, calls std::terminate.

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