Skip to content

Merge TaskScheduler and IOCore into one scheduler #45

@Gerold103

Description

@Gerold103

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 IOCore has 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 Task and the heavy IOTask as a separate thing. They could have a common base, and both be final. 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 an IOTask.
  • Perhaps, there is a way to make IOTask implemented on top of Task? 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 if IOTask would be hidden inside the Task's callback. Besides, it might become problematic in the future if more types of tasks would be added, like for signal handling (similar to boost::asio::signal_set).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions