summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2021-06-21 15:54:05 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2021-10-19 10:14:24 +0200
commit2b90577da89a3b63714b6f560646db9724515f56 (patch)
treedd1a0e59aefbdf1e6c213d27c750745837e1d025 /src
parent1d2d8f30551e54e9e5e760e445f66059f8a1c78e (diff)
downloadqtserialport-2b90577da89a3b63714b6f560646db9724515f56.tar.gz
Revert "Emit _q_notify only if there's no notification pending"
This reverts commit 85ee2c658a45d2958a54045951d236769640337f. Part of chain revert to go back to QWinOverlappedIoNotifier. Task-number: QTBUG-93865 Change-Id: I2f6c56127b86a8ffdc7ed52421d18f35fa349af9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-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 81cacb2..f29bae0 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;
};
@@ -398,17 +397,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()