boost::spawn(Fn) without any boost::asio::io_context, then in the function I create an io_context and use it with the yield_context coroutine to do async calls like async_resolve etc.... problem is this yeild_context given is not attached to an io_context so I get this error:
boost::wrapexcept<boost::coroutines::invalid_result>std::exception::what: Operation not permitted because coroutine has no valid result.
I know this because but when I launch with boost::spawn(io_context, Fn) everything works fine. Is there a way around this since I don't want to call io_context from my library(what I am using) so that other users of it can determine for themselves how many threads they want io_context to run on.
I am a novice.. but io_context runs on a single thread only right? If you want parallel contexts running you can try using strands maybe?
Обсуждают сегодня