C++20 Concurrency: part-3 request_stop and stop_token for std::jthread
In this article, we explore the latest feature of C++20’s
std::jthreadthat allows one to signal a stop or cancellation to an already executing thread in certain situation. Quoting the first line again from cpp reference:
jthreadrepresents a single thread of execution … , and can be cancelled/stopped in certain situations.