Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Rust-based event loop instead of Qt event loop in proxy/handler #48139

Open
4 of 8 tasks
jkarneges opened this issue Feb 27, 2025 · 0 comments
Open
4 of 8 tasks

Use Rust-based event loop instead of Qt event loop in proxy/handler #48139

jkarneges opened this issue Feb 27, 2025 · 0 comments

Comments

@jkarneges
Copy link
Member

jkarneges commented Feb 27, 2025

Significant progress on this has already been made, but I figured it would be good to have some kind of tracking issue since it's a big change.

The connmgr component uses async tasks, driven by the Executor and Reactor Rust types, whereas the proxy and handler components use callbacks driven by the Qt event loop (QEventLoop / QCoreApplication). Ideally, we could consolidate on the same Rust-based evented subsystem for all three components. In other words, the proxy and handler ought to be able to use Reactor (and perhaps more) in place of the Qt event loop.

Benefits of this change:

  • The proxy and handler get a more performant evented subsystem.
  • Consistent behavior across all components. Don't have two subsystems to debug.
  • Opens the door to potentially being able to run evented Rust code and evented C++ code in the same thread.

In order to move off of the Qt event loop to something else, we need substitutes for all things we are using that depend on it. These are:

  • QTimer
  • QSocketNotifier
  • QTcpSocket & QTcpServer
  • QMetaObject::invokeMethod with Qt::QueuedConnection
  • QObject::deleteLater

We also need some kind of event loop substitute that allows registering callbacks for socket/timer activity, similar to QAbstractEventDispatcher but built on top of Reactor.

Tasks:

  • - Make a substitute event loop class on top of Reactor, allowing callback registrations for file descriptors and timers.
  • - Make our own socket notifier class that works with the new event loop.
  • - Make our own timer class that works with the new event loop.
  • - Make a mechanism for deferred calls (including deferred deletes), based on our own timers.
  • - Make it possible to queue calls across threads.
  • - Make our own TCP socket/listener classes, based on our own socket notifiers.
  • - Use our alternatives everywhere in the handler. Listing this component first since it's single threaded and therefore a little easier.
  • - Use our alternatives everywhere in the proxy.
@jkarneges jkarneges changed the title Use Rust-based event loop instead of Qt event loop Use Rust-based event loop instead of Qt event loop in proxy/handler Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant