Commit 728f3e73 authored by Denis Shienkov's avatar Denis Shienkov Committed by The Qt Project
Browse files

Do not time out for -1 msec (wait methods)

According to the documentation of QIODevice:

* http://qt-project.org/doc/qt-5.1/qtcore/qiodevice.html#waitForBytesWritten

* http://qt-project.org/doc/qt-5.1/qtcore/qiodevice.html#waitForReadyRead

these wait methods should not time out if msecs is -1.

Currently, the behavior does not match the expected behavior as the
negative values were overridden by zero. The operation returns as
soon as the event loop processing happens.

Now this problem is solved for Windows: the INFINITE flag has been
added to the WaitForMultipleObjects call. See the MSDN documentation
for details below:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms687025%28v=vs.85%29.aspx



Note: the check is added only for -1 to be consistent with the behavior
of other QIODevice subclasses. If it is any other negative integer, the
value will be cast to the corresponding positive value which will
indicate the waiting time.

Tested with Qt4 and then Qt5.

Change-Id: I2b8c8310723bca7beb9af0213edf4c855b5ac6ae
Reviewed-by: default avatarLaszlo Papp <lpapp@kde.org>
Reviewed-by: default avatarSergey Belyashov <Sergey.Belyashov@gmail.com>
parent 0f52055f
Showing with 1 addition and 1 deletion
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