C++ 23 · Input, exceptions and threads

Run code on another thread

Start a thread and wait for it. std::jthread joins automatically when it is destroyed (C++20).

std::jthread worker([] { std::cout << "working\n"; });

Official C++ 23 documentation

More input, exceptions and threads commands

All input, exceptions and threads commands · C++ 23 cheatsheet

Was this page helpful?