The thing is that I would like to create a global instance which I would be able to use separately by each coroutine to keep there, for instance, the list of named scopes, e.g. for log purposes.
so that when boost::asio::spawn
is called a new custom state would be attached to the newly run coroutine.
As a guess, as a workaround it could be done by means of a global std::unordered_map
indexed by smth similar to std::this_thread::get_id()
but for coroutines. Yet right now I'm not aware of anything like that.
While it would be perfect if it is possible to accomplish this by a custom asio::yield_context
. It keeps cancellation_slot
, executor
, why it cannot keep extra state? I have tryed to dig into the boost sources of yield_context
, but I'm rather lost there, that's why I would appreciate some insights on this matter.