summarylogtreecommitdiffstats
path: root/0001-Revert-Emit-_q_notify-only-if-there-s-no-notificatio.patch
blob: 9e32c273b3c6986ab22348feb2e4f56f11a51d40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 878bb0fc614f83757b69ba7665babc7fc7d56b01 Mon Sep 17 00:00:00 2001
From: Denis Shienkov <denis.shienkov@gmail.com>
Date: Fri, 6 Sep 2019 21:19:52 +0300
Subject: [PATCH] Revert "Emit _q_notify only if there's no notification
 pending"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 85ee2c658a45d2958a54045951d236769640337f.

That commit completely breaks the I/O on Windows.

Task-number: QTBUG-78086
Change-Id: I6c6b8ef0b5af7bd9dcbea791fbb8322c9e68b900
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f6b43c36b3839dae54308a6437bbdd99ae9a44de)
---
 src/serialport/qwinoverlappedionotifier.cpp | 10 +++-------
 1 file 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()
-- 
2.23.0