-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
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_contextabstract 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels