summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-12-29 11:35:36 -0200
committerThiago Macieira <thiago.macieira@intel.com>2015-09-15 02:08:36 +0000
commitc2049f67e4cfe5f09e1b033b910cb37d043a287e (patch)
tree72c9760dd86acdadbcd1261443cb923ce7ed9235 /tests
parent939b7c630d3f51224eacb6596f0ea2267ca5bfe5 (diff)
Use a dedicated thread for handling incoming libdbus-1 events
Each application will have one thread dedicated for this, for all QDBusConnections. I wouldn't mind sharing such a thread with other uses in Qt, provided none of them ever block (the QProcessManager thread comes to mind, but it's going away soon). The cost associated with this change in this commit is so far rather minimal. All incoming D-Bus calls need to be handled after an event is posted anyway, to avoid deadlocking on reentering libdbus-1 functions that acquire locks still held. The cost is the one more thread running and the cost of synchronizing them when an event is posted. The benefits far outweigh that cost: no longer will we have problems of QtDBus failing to run if the main system or session connections are used before QCoreApplication is run. Moreover, events can be received and handled in aux threads even if the main thread is blocked on some operation. Note: this commit may not be testable (tst_qdbusconnection may fail) Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b737556ccd11a8 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp33
1 files changed, 1 insertions, 32 deletions
diff --git a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
index 9c334f77a2..cc12ef8bcc 100644
--- a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
+++ b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -172,10 +173,6 @@ QDBusPendingCall tst_QDBusPendingCall::sendError()
void tst_QDBusPendingCall::waitForFinished()
{
QDBusPendingCall ac = sendMessage();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
ac.waitForFinished();
QVERIFY(ac.isFinished());
QVERIFY(!ac.isError());
@@ -195,10 +192,6 @@ void tst_QDBusPendingCall::waitForFinished()
void tst_QDBusPendingCall::waitForFinished_error()
{
QDBusPendingCall ac = sendError();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
ac.waitForFinished();
QVERIFY(ac.isFinished());
QVERIFY(ac.isError());
@@ -254,10 +247,6 @@ void tst_QDBusPendingCall::callWithCallback_localLoop_errorReply()
void tst_QDBusPendingCall::watcher()
{
QDBusPendingCall ac = sendMessage();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
callCount = 0;
watchArgument = 0;
@@ -284,10 +273,6 @@ void tst_QDBusPendingCall::watcher()
void tst_QDBusPendingCall::watcher_error()
{
QDBusPendingCall ac = sendError();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
callCount = 0;
watchArgument = 0;
@@ -312,10 +297,6 @@ void tst_QDBusPendingCall::watcher_error()
void tst_QDBusPendingCall::watcher_waitForFinished()
{
QDBusPendingCall ac = sendMessage();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
callCount = 0;
watchArgument = 0;
@@ -391,10 +372,6 @@ void tst_QDBusPendingCall::watcher_waitForFinished_threaded()
void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished()
{
QDBusPendingCall ac = sendMessage();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
ac.waitForFinished();
QVERIFY(ac.isFinished());
QVERIFY(!ac.isError());
@@ -425,10 +402,6 @@ void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished()
void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished_eventLoop()
{
QDBusPendingCall ac = sendMessage();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
ac.waitForFinished();
QVERIFY(ac.isFinished());
QVERIFY(!ac.isError());
@@ -462,10 +435,6 @@ void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished_eventLoop()
void tst_QDBusPendingCall::watcher_waitForFinished_error()
{
QDBusPendingCall ac = sendError();
- QVERIFY(!ac.isFinished());
- QVERIFY(!ac.isError());
- QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
-
callCount = 0;
watchArgument = 0;