Skip to content

Refactoring in preparation for new in-RTS I/O managers

Following on from MR !4745 (closed), this MR consists of a further sequence of refactoring steps to the RTS I/O manager code. It goes further in the same direction as the previous MR: making the I/O manager things in the RTS more abstract and modular, hiding representations behind proper APIs in IOManager.h rather than having other bits of the RTS do I/Oish things directly.

For example, the async exception throwTo impl needs to unblock threads that are blocked on I/O or timers, which involves I/Oish things. Previously it poked those things directly, and now it goes via a proper API. And on the other side of that API we can switch on the I/O manager to call into the right impl.

This MR is also preparation for new I/O managers. It is needed to support our ability to have different I/O managers compiled in, and to select one at RTS startup. In particular the next MR following on from this one adds a new I/O manager based on poll().

Where this is going:

  • We should end up with I/O managers using, poll(), Linux epoll and Linux io_uring (BSDish ones should be possible too)
  • All following a similar pattern (with the interface defined by IOManager.h) and sharing infrastructure
  • Which one is used can be selected at startup
  • Eventually we will be able to remove quirky and slow legacy code for the old select() I/O manager (and its custom tso->blocked_info).
  • It may also be possible to have a win32 one in this style too (possibly allowing us to retire the quirky legacy win32 one).

Note: this MR is designed to be read patch by patch, as a series of smallish refactoring steps or other changes.

Edited by Duncan Coutts

Merge request reports