Код: Выделить всё
#include
#include
#include
namespace asio = boost::asio;
using namespace asio::experimental::awaitable_operators;
using namespace std::chrono_literals;
using std::this_thread::sleep_for;
static thread_local int const t_id = [] {
static std::atomic_int gen = 0;
return ++gen;
}();
#include
static auto stamp() {
static const auto start = std::chrono::steady_clock::now();
return (std::chrono::steady_clock::now() - start)/1ms;
}
#define TRACE() \
std::osyncstream(std::cout)
Подробнее здесь: [url]https://stackoverflow.com/questions/79423374/use-strands-instead-of-mutexes-in-a-multi-threaded-program[/url]