C++20 Concurrency: <stop_token>
In a previous article, I talked about using std::jthread
as a simpler and safer way to create multi-threaded C++ programs using C++20. However, I did not discuss the benefits of using the C++20 <stop_token>
library header alongside std::jthread
for simple cancellation of coroutines and asynchronous tasks.
What is the <stop_token>
header used for?
This header contains a few useful components, including std::stop_token
…