This line
|
return *timer_service_access::get_scheduler(static_cast<io_context&>(ctx)) |
assumes that a capy::execution_context is always a corosio::io_context. This is not enforced, and execution_context can be default constructed.
capy::execution_context ec;
timer t(ec);
There's nothing obviously wrong with this code yet it'll cause a SIGSEV.
There are three solutions:
- make
execution_context abstract so it cannot be constructed this way
- throw an exception if it's not an
io_context, so it cannot run the scheduler
- implicitly construct a thread and let it run the scheduler (what asio does).
Note that Nr.3 would allow us to put an asio::io_context into an capy::any_executor. That would enable users to add corosio functionality to an existing asio app without rewriting everything.
This line
corosio/include/boost/corosio/detail/timer_service.hpp
Line 903 in 07fab88
assumes that a
capy::execution_contextis always acorosio::io_context. This is not enforced, andexecution_contextcan be default constructed.capy::execution_context ec; timer t(ec);There's nothing obviously wrong with this code yet it'll cause a SIGSEV.
There are three solutions:
execution_contextabstract so it cannot be constructed this wayio_context, so it cannot run the schedulerNote that Nr.3 would allow us to put an asio::io_context into an
capy::any_executor. That would enable users to add corosio functionality to an existing asio app without rewriting everything.