diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-28 03:02:33 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-28 03:02:33 +0200 |
commit | 110a32dd6524adcf738d1d755d0a135fd34f3cbc (patch) | |
tree | 91097fb1c5150c64cda5ff856e2b05ebfb354524 /src/serialport/qwinoverlappedionotifier.cpp | |
parent | 0e533ffe0e3260a9a08f2583bb90f2b503ae4f68 (diff) | |
parent | e491b2ce3f1ece9959a66624b934bf41428b2d76 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I7fdf543f846d7259db456c000b93aed4589795ad
Diffstat (limited to 'src/serialport/qwinoverlappedionotifier.cpp')
-rw-r--r-- | src/serialport/qwinoverlappedionotifier.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/serialport/qwinoverlappedionotifier.cpp b/src/serialport/qwinoverlappedionotifier.cpp index 233ee696..615dacc9 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() |