Intermediate
C++
Q89 / 100
What is std::jthread and how does it differ from std::thread?
Correct! Well done.
Incorrect.
The correct answer is A) jthread is a thread that joins automatically in its destructor and supports cooperative cancellation via stop_token
A
Correct Answer
jthread is a thread that joins automatically in its destructor and supports cooperative cancellation via stop_token
Explanation
std::jthread (C++20) automatically calls join() in its destructor, preventing the "thread destructor calls std::terminate" bug. It also supports stop_source/stop_token for cancellation.
Progress
89/100