diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-08-31 13:03:47 +0200 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-10-14 18:38:24 +0000 |
commit | 243c3044b647357ca6df79ac1497ae43de957d31 (patch) | |
tree | 44c03794457a49a36cbfabd3e0b83733f879ddd7 /src/plugins/platforms/xcb/qxcbnativeinterface.cpp | |
parent | a880780ff962dc31be24b508f811c1a2fd0b0f36 (diff) |
xcb: lock-free event processing
For details how this works refer to the documentation in the patch.
The follow-up patches will switch to calling processXcbEvents() on every
event loop iteration. With the existing code that would mean frequent
locking of shared data (event queue). Acquiring a lock is fast, but
lock contention isn't. To avoid potential problems, reimplement xcb event
processing to be lock-free. Besides theoretical performance benefits,
this definitally improves code readability in qxcbconnection.cpp. Thanks
to Mikhail Svetkin for questioning the design of the existing code.
Done-with: Mikhail Svetkin <mikhail.svetkin@qt.io>
Change-Id: I935f2b6ca802580f5c80205aef7b2f9afc172d26
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbnativeinterface.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 98bedea48a..524af5a2a7 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -437,20 +437,20 @@ void QXcbNativeInterface::setAppUserTime(QScreen* screen, xcb_timestamp_t time) qint32 QXcbNativeInterface::generatePeekerId() { QXcbIntegration *integration = QXcbIntegration::instance(); - return integration->defaultConnection()->generatePeekerId(); + return integration->defaultConnection()->eventQueue()->generatePeekerId(); } bool QXcbNativeInterface::removePeekerId(qint32 peekerId) { QXcbIntegration *integration = QXcbIntegration::instance(); - return integration->defaultConnection()->removePeekerId(peekerId); + return integration->defaultConnection()->eventQueue()->removePeekerId(peekerId); } -bool QXcbNativeInterface::peekEventQueue(QXcbConnection::PeekerCallback peeker, void *peekerData, - QXcbConnection::PeekOptions option, qint32 peekerId) +bool QXcbNativeInterface::peekEventQueue(QXcbEventQueue::PeekerCallback peeker, void *peekerData, + QXcbEventQueue::PeekOptions option, qint32 peekerId) { QXcbIntegration *integration = QXcbIntegration::instance(); - return integration->defaultConnection()->peekEventQueue(peeker, peekerData, option, peekerId); + return integration->defaultConnection()->eventQueue()->peekEventQueue(peeker, peekerData, option, peekerId); } void QXcbNativeInterface::setStartupId(const char *data) |