Commit c2049f67 authored by Thiago Macieira's avatar Thiago Macieira
Browse files

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: default avatarAlbert Astals Cid <aacid@kde.org>
Reviewed-by: default avatarAlex Blasche <alexander.blasche@theqtcompany.com>
parent 939b7c63
Showing with 50 additions and 70 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment