std::jthread stands for joining thread. In addition to std::thread (C++11), std::jthread automatically joins in its destructor and can cooperatively be interrupted. Read this post to know why std::jthread should be your first choice.
A typical question in my C++ seminars is: Can a thread be killed? Before C++20, my answer is no. With C++20, you can ask a thread politely for its interruption.
One of the participants in my CppCon 2018 workshop asked me: "Can a std::thread be interrupted?". No, that was my answer, but this is not correct anymore. With C++20, we might get a std::jthread.
Hunting
Today 4639
Yesterday 6193
Week 10832
Month 32506
All 12110715
Currently are 180 guests and no members online
Kubik-Rubik Joomla! Extensions
Read more...
Read more...