Why no jthreads?

I’m reading a book about C++20, got to the part about jthreads, and discovered the type doesn’t exist. At least I don’t see it with #include <thread>. Is it just something no one got around to yet?

1 Like

It seems to exist in libstdc++, but not in libc++: Compiler Explorer

That’s correct, libc++ hasn’t implemented jthread yet.
When you want to use C++20 or C++23 features I would suggest to look at the implementation status in libc++ or
cpprefernce to make sure all compilers/libraries, you care about, support these features.

I know C++20 has been released quite a while ago, but compiler and library support is still not generally available. (Unfortunately libc++ is lagging behind the other 2 main vendors.)