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 am trying to use QtScheduler in conjunction with ThreadPoolScheduler, the idea being to perform network operations in background threads, and then to call back into the UI.
Hello,
better late than never, the QtScheduler can not be 'mixed' with schedulers that schedule elements on an other thread than the Qt thread. This is because QtScheduler is based on QTimer which is not thread safe and cannot be started from another thread (more specifically outside of a QThread).
So you have to specify for each operator in your chain that accepts a scheduler as argument your QtScheduler. In RxPY3 (wip), you will specify the desired scheduler in subscribe method for all the upstream chain. This is decribed here.
Alternatively, I've been working on a QtScheduler which should be thread safe. It's available here: https://github.com/jcafhe/RxPY/tree/qt-threadsafe
It defines a new scheduler in rx.concurrency.mainloopscheduler.qtthreadsafe which is based on QtCore.QCoreApplication.postEvent(). There are some examples in rx/examples/qtthreadsafe. Keep in mind it's just a prototype and may be out of date but please feel free to improve it.
@jcafhe Thank you. Your thread-safe version of QtScheduler works well. Can you please elaborate what "thread-safe" means in the context of rx? I ran into the similar problem of AsyncioThreadSafeScheduler and AsyncioScheduler before.
Hello.
I am trying to use QtScheduler in conjunction with ThreadPoolScheduler, the idea being to perform network operations in background threads, and then to call back into the UI.
I get this error from
_qtimer_schedule
:Please, see this gist for a test case.
Is this behavior expected?
The text was updated successfully, but these errors were encountered: