diff options
author | Andreas Hartmetz <ahartmetz@gmail.com> | 2017-11-05 11:16:00 +0100 |
---|---|---|
committer | Andreas Hartmetz <ahartmetz@gmail.com> | 2017-11-08 05:38:39 +0000 |
commit | eeca8895fc7e585f497e908368b8cc1a509847d3 (patch) | |
tree | 6e900fa4259be090ec8a6c486b83d7b34d346293 /src/dbus/qdbusconnection_p.h | |
parent | bfcad18526dc064ac7dd1a08781c60d1d1673a0b (diff) |
Remove obsolete DBus dispatch lock
In c2049f67e4cfe5f09e1b033b910cb37d043a287e, all DBus I/O was
moved into a service thread. The dispatch lock used to protect
DBus I/O in the threading setup before that commit. It is not
needed anymore.
No discernible difference in QtDBus benchmarks, roughly 500
bytes code size reduction on AMD64. The main point is to reduce
confusion from unnecessary code.
Change-Id: Idcbdd2b7e2b317cf6da0b5bfc5ec70afed1f1b48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusconnection_p.h')
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 6e58c5bd21..3043d7378c 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -59,7 +59,6 @@ #include <QtCore/qatomic.h> #include <QtCore/qhash.h> -#include <QtCore/qmutex.h> #include <QtCore/qobject.h> #include <QtCore/qpointer.h> #include <QtCore/qreadwritelock.h> @@ -198,7 +197,6 @@ public: ~QDBusConnectionPrivate(); void createBusService(); - void setDispatchEnabled(bool enable); void setPeer(DBusConnection *connection, const QDBusErrorInternal &error); void setConnection(DBusConnection *connection, const QDBusErrorInternal &error); void setServer(QDBusServer *object, DBusServer *server, const QDBusErrorInternal &error); @@ -275,6 +273,7 @@ protected: public slots: // public slots + void setDispatchEnabled(bool enable); void doDispatch(); void socketRead(int); void socketWrite(int); @@ -312,9 +311,6 @@ public: QDBusServer *serverObject; }; - // the dispatch lock protects everything related to the DBusConnection or DBusServer - // including the timeouts and watches - QMutex dispatchLock; union { DBusConnection *connection; DBusServer *server; @@ -390,7 +386,9 @@ public: public slots: void execute() { - con->setDispatchEnabled(true); + // This call cannot race with something disabling dispatch only because dispatch is + // never re-disabled from Qt code on an in-use connection once it has been enabled. + QMetaObject::invokeMethod(con, "setDispatchEnabled", Qt::QueuedConnection, Q_ARG(bool, true)); if (!con->ref.deref()) con->deleteLater(); deleteLater(); |