std::jthread - I Told You Concurrency is Tricky

By Nico Josuttis

With C++20 we will have a new basic thread class, std::jthread.

It will fix a few flaws of std::thread, which was not designed as an easy to use RAII type and lacks the ability to support stopping a running thread.

Sounds like we only have to implement a better destructor and add a parameter to signal cancellation.

But especially with concurrency the devil is in the details.

This is not just a talk about jthread. It is a talk about how implementing even pretty simply concurrency requirements can become a tricky task with many many traps.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.