You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started using threads and ran into some issues. Turns out that while the reactor was 'working' for many things it wasn't getting started correctly and so deferToThread() didn't work and even when I started it up the application would then hang on exit.
What is the proper way to launch the qt5reactor and QApplication?
The readme covers installing the reactor in one of two ways but does not cover reactor.run() vs app.exec() or maybe something with reactor.runReturn() or...
My simple example for deferToThread() (both for qt5reactor and pure twisted) are available in this gist.
I don't know that there's a strictly "proper" method (since either method could work), however, reactor.run() is arguably the most straightforward of the two since, if I'm not mistaken, with QApplication.exec_() alone you would still have to start the reactor elsewhere in order to use the Twisted API (which largely defeats the primary purpose of the library -- i.e., to run/schedule both Qt and Twisted events within the same event-loop/thread).
My guess is that the reactor.runReturn() method described in the docstring is likely only intended for use-cases in which you might need to shutdown or restart the Twisted reactor for some reason while still keeping your Qt app running afterwards.
Seems to work there and look kinda clean (even if my gut says Twisted should be subserviant to Qt :]). I'll give it a try in my real application as well as Windows (I'm in Linux most of the time).
I started using threads and ran into some issues. Turns out that while the reactor was 'working' for many things it wasn't getting started correctly and so
deferToThread()
didn't work and even when I started it up the application would then hang on exit.What is the proper way to launch the
qt5reactor
andQApplication
?The readme covers installing the reactor in one of two ways but does not cover
reactor.run()
vsapp.exec()
or maybe something withreactor.runReturn()
or...My simple example for
deferToThread()
(both forqt5reactor
and puretwisted
) are available in this gist.https://gist.github.com/altendky/faf48446c335418dac8793635d119750
The text was updated successfully, but these errors were encountered: