-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
That would be very convenient. There is a visible confusion when people see 2 schedulers.
This might make the code of the new one-scheduler a bit more complex than those existing two, but the unification will drop a lot of duplicated code, and will allow to run a single threaded scheduler for everything, like a traditional event-loop. And even more similar to how boost::asio::io_context is able to work.
It should also allow to use the C++ coroutines wider. Currently it is a problematic that IOCore can't support the coroutines "by design", while TaskScheduler is ok with them.
However there are some architecture obstacles that need to be addressed:
- How to handle the fact that
IOCorehas no task-signal state. Need to find a way to move closing/closed states into a new place somehow. - Need a class hierarchy for the tasks. There needs to remain a plain lightweight
Taskand the heavyIOTaskas a separate thing. They could have a common base, and both befinal. The new scheduler would have to look at the task's type in some cases, like when needs to merge ready and pending events or when handling closure of anIOTask. - Perhaps, there is a way to make
IOTaskimplemented on top ofTask? The only problem is how would the scheduler handle some work such as socket closure or waiting for the operations to end on Windows. Those things require knowing the task's internals. Which won't be possible ifIOTaskwould be hidden inside theTask's callback. Besides, it might become problematic in the future if more types of tasks would be added, like for signal handling (similar toboost::asio::signal_set).