diff options
author | Gerry Boland <gerry.boland@canonical.com> | 2015-05-01 14:34:42 +0100 |
---|---|---|
committer | Gerry Boland <gerry.boland@canonical.com> | 2015-05-01 14:34:42 +0100 |
commit | ab866b2b74341632ef58473434092a597fb641ae (patch) | |
tree | 84c58edc64e82cf42255c96f46cffffb83b0b40c /src | |
parent | c55b26f96ce02b6811f4ca86d950ddabb3d529f7 (diff) |
Signal/slot just to start/stop a thread is wasteful, using invokeMethod instead
Diffstat (limited to 'src')
-rw-r--r-- | src/platforms/mirserver/qmirserver.cpp | 9 | ||||
-rw-r--r-- | src/platforms/mirserver/qmirserver.h | 4 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/platforms/mirserver/qmirserver.cpp b/src/platforms/mirserver/qmirserver.cpp index d946f2d..acf033e 100644 --- a/src/platforms/mirserver/qmirserver.cpp +++ b/src/platforms/mirserver/qmirserver.cpp @@ -17,7 +17,7 @@ // Qt #include <QObject> #include <QCoreApplication> -#include <QMetaMethod> +#include <QMetaObject> #include <QDebug> // local @@ -46,9 +46,6 @@ QMirServer::QMirServer(const QStringList &arguments, QObject *parent) d->serverWorker = new MirServerWorker(d->server); d->serverWorker->moveToThread(&d->serverThread); - connect(this, &QMirServer::runServer, d->serverWorker, &MirServerWorker::run); - connect(this, &QMirServer::stopServer, d->serverWorker, &MirServerWorker::stop); - connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, d->serverWorker, &MirServerWorker::stop, Qt::DirectConnection); // see FIXME in MirServerWorker connect(d->serverWorker, &MirServerWorker::stopped, this, &QMirServer::serverStopped, Qt::DirectConnection); @@ -64,7 +61,7 @@ bool QMirServer::run() Q_D(QMirServer); d->serverThread.start(QThread::TimeCriticalPriority); - Q_EMIT runServer(); + QMetaObject::invokeMethod(d->serverWorker, "run"); if (!d->serverWorker->waitForMirStartup()) { @@ -81,7 +78,7 @@ bool QMirServer::stop() Q_D(QMirServer); if (d->serverThread.isRunning()) { - Q_EMIT stopServer(); + QMetaObject::invokeMethod(d->serverWorker, "stop"); if (!d->serverThread.wait(10000)) { // do something to indicate fail during shutdown qCritical() << "ERROR: QMirServer - Mir failed to shut down correctly, terminating it"; diff --git a/src/platforms/mirserver/qmirserver.h b/src/platforms/mirserver/qmirserver.h index 4008a80..9f3f592 100644 --- a/src/platforms/mirserver/qmirserver.h +++ b/src/platforms/mirserver/qmirserver.h @@ -43,10 +43,6 @@ protected: Q_SLOT void serverStopped(); -Q_SIGNALS: - void runServer(); - void stopServer(); - private: Q_DISABLE_COPY(QMirServer) Q_DECLARE_PRIVATE(QMirServer) |