Код: Выделить всё
#include
#include
#include
#include
std::promise prm;
auto fut = prm.get_future();
void f(std::stop_token const& ST)
{
while (not ST.stop_requested())
{
auto const status = fut.wait_for(std::chrono::milliseconds(100));
if (status == std::future_status::ready)
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79179424/using-stdfuture-in-a-loop[/url]