qt5base-lts/tests/auto
Alex Trotsenko ee122077b0 Allow QWindowsPipe{Reader,Writer} to work with foreign event loops
When a foreign event loop that does not enter an alertable wait state
is running (which is also the case when a native dialog window is
modal), pipe handlers would freeze temporarily due to their APC
callbacks not being invoked.

We address this problem by moving the I/O callbacks to the Windows
thread pool, and only posting completion events to the main loop
from there. That makes the actual I/O completely independent from
any main loop, while the signal delivery works also with foreign
loops (because Qt event delivery uses Windows messages, which foreign
loops typically handle correctly).

As a nice side effect, performance (and in particular scalability)
is improved.

Several other approaches have been tried:
1) Using QWinEventNotifier was about a quarter slower and scaled much
   worse. Additionally, it also required a rather egregious hack to
   handle the (pathological) case of a single thread talking to both
   ends of a QLocalSocket synchronously.
2) Queuing APCs from the thread pool to the main thread and also
   posting wake-up events to its event loop, and handling I/O on the
   main thread; this performed roughly like this solution , but scaled
   half as well, and the separate wake-up path was still deemed hacky.
3) Only posting wake-up events to the main thread from the thread pool,
   and still handling I/O on the main thread; this still performed
   comparably to 2), and the pathological case was not handled at all.
4) Using this approach for reads and that of 3) for writes was slightly
   faster with big amounts of data, but scaled slightly worse, and the
   diverging implementations were deemed not desirable.

Fixes: QTBUG-64443
Change-Id: I1cd87c07db39f3b46a2683ce236d7eb67b5be549
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-17 12:45:50 +02:00
..
cmake CMake: Add support for -binary option for generated resources 2020-11-12 22:11:37 +01:00
concurrent Automatically generate unit tests for QtConcurrent 2020-11-09 16:01:33 +01:00
corelib Simplify reallocation handling in QList 2020-11-17 11:45:46 +01:00
dbus QChar: make construction from integral explicit 2020-11-15 14:41:05 +01:00
gui Allow QWindowsPipe{Reader,Writer} to work with foreign event loops 2020-11-17 12:45:50 +02:00
guiapplauncher Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
installed_cmake
network Allow QWindowsPipe{Reader,Writer} to work with foreign event loops 2020-11-17 12:45:50 +02:00
opengl Remove tst_QGL 2020-08-28 11:43:11 +02:00
other Conditionally disable tests that depend on cxx11_future flag 2020-11-17 05:21:06 +00:00
printsupport Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
shared Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
sql Cleanup remaining QVariant::Type uses in Qt Sql 2020-10-17 12:01:54 +02:00
testlib QSignalSpy: Use QMetaType instead of metatype id in initArgs 2020-11-10 11:23:55 +01:00
tools Android: exclude host tools tests for android and ios 2020-11-16 11:35:33 +00:00
widgets Android: move blocked tests of qapplication to test folder 2020-11-16 13:35:49 +02:00
xml QChar: make construction from integral explicit 2020-11-15 14:41:05 +01:00
.prev_CMakeLists.txt CMake: Regenerate projects 2020-09-22 19:08:53 +02:00
auto.pro Don't error out when configuring Qt on a headless system 2020-09-26 14:36:13 +02:00
CMakeLists.txt CMake: Fix building with -DQT_FEATURE_gui=OFF 2020-09-15 20:05:32 +02:00
network-settings.h Revert "QAbstractSocket: deprecate 'error' member-function" 2020-02-26 23:07:52 +03:00