Skip to content

Commit

Permalink
Remove unused Qt scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
leemaguire committed Jun 5, 2024
1 parent 09c8e5c commit 53bfeb0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
1 change: 0 additions & 1 deletion include/cpprealm/schedulers/default_schedulers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ namespace realm {
* - CFRunLoop for Apple platforms
* - UV for Linux and Windows
* - ALooper for Android
* - Qt event dispatcher
* If no suitable scheduler is available a generic scheduler will be provided.
*/
std::shared_ptr<scheduler> make_platform_default();
Expand Down
44 changes: 1 addition & 43 deletions src/cpprealm/schedulers/default_schedulers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
#include <uv.h>
#endif

#ifdef QT_CORE_LIB
#include <QStandardPaths>
#include <QMetaObject>
#include <QTimer>
#include <QThread>
#include <QtWidgets/QApplication>
#endif

namespace realm {

void realm_core_scheduler::invoke(std::function<void()> &&fn) {
Expand All @@ -39,38 +31,6 @@ namespace realm {
return s;
}

#if QT_CORE_LIB
struct qt_main_loop_scheduler : public QObject, public realm::scheduler {

bool is_on_thread() const noexcept override {
{
return m_id == std::this_thread::get_id();
}
bool is_same_as(const scheduler *other) const noexcept override {
{
auto o = dynamic_cast<const QtMainLoopScheduler*>(other);
return (o && (o->m_id == m_id));
}
bool can_invoke() const noexcept override {
{
return QThread::currentThread()->eventDispatcher();
}

void invoke(std::function<void()> &&fn) override {
QMetaObject::invokeMethod(this, fn);
}
private:
std::thread::id m_id = std::this_thread::get_id();
};
#endif

std::shared_ptr<util::Scheduler> make_default_scheduler() {
#if QT_CORE_LIB
util::Scheduler::set_default_factory(make_qt);
#endif
return util::Scheduler::make_default();
}

#if defined(REALM_HAVE_UV) && REALM_HAVE_UV
class invocation_queue {
public:
Expand Down Expand Up @@ -161,9 +121,7 @@ namespace realm {
#endif

std::shared_ptr<scheduler> default_schedulers::make_platform_default() {
#if QT_CORE_LIB
return std::make_shared<qt_main_loop_scheduler>();
#elif REALM_PLATFORM_APPLE || REALM_ANDROID && !defined(REALM_AOSP_VENDOR)
#if REALM_PLATFORM_APPLE || REALM_ANDROID && !defined(REALM_AOSP_VENDOR)
return std::make_shared<realm_core_scheduler>(util::Scheduler::make_platform_default());
#elif defined(REALM_HAVE_UV) && REALM_HAVE_UV
return make_uv(uv_default_loop());
Expand Down

0 comments on commit 53bfeb0

Please sign in to comment.