summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-09-06 21:19:52 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-09-09 08:39:22 +0000
commitf6b43c36b3839dae54308a6437bbdd99ae9a44de (patch)
tree6779f911bfad0ac6c1959a2bd419a869a9191ebd
parent8db0ef30def0b776d900bd7520a91d2cb1444041 (diff)
downloadqtserialport-f6b43c36b3839dae54308a6437bbdd99ae9a44de.tar.gz
Revert "Emit _q_notify only if there's no notification pending"
This reverts commit 85ee2c658a45d2958a54045951d236769640337f. That commit completely breaks the I/O on Windows. Task-number: QTBUG-78086 Change-Id: I9125967d6cb5b1cb4e33d0bad80ee66322e5ccc7 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/serialport/qwinoverlappedionotifier.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/serialport/qwinoverlappedionotifier.cpp b/src/serialport/qwinoverlappedionotifier.cpp
index 233ee69..615dacc 100644
--- a/src/serialport/qwinoverlappedionotifier.cpp
+++ b/src/serialport/qwinoverlappedionotifier.cpp
@@ -129,7 +129,6 @@ public:
HANDLE hSemaphore = nullptr;
HANDLE hResultsMutex = nullptr;
QAtomicInt waiting;
- QAtomicInt pendingNotifications;
QQueue<IOResult> results;
};
@@ -396,17 +395,14 @@ void QWinOverlappedIoNotifierPrivate::notify(DWORD numberOfBytes, DWORD errorCod
results.enqueue(IOResult(numberOfBytes, errorCode, overlapped));
ReleaseMutex(hResultsMutex);
ReleaseSemaphore(hSemaphore, 1, NULL);
- if (!waiting && pendingNotifications-- == 0)
+ if (!waiting)
emit q->_q_notify();
}
void QWinOverlappedIoNotifierPrivate::_q_notified()
{
- int n = pendingNotifications.fetchAndStoreAcquire(0);
- while (--n >= 0) {
- if (WaitForSingleObject(hSemaphore, 0) == WAIT_OBJECT_0)
- dispatchNextIoResult();
- }
+ if (WaitForSingleObject(hSemaphore, 0) == WAIT_OBJECT_0)
+ dispatchNextIoResult();
}
OVERLAPPED *QWinOverlappedIoNotifierPrivate::dispatchNextIoResult()