summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qwinoverlappedionotifier_p.h
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2012-09-29 17:55:32 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-02 08:05:55 +0200
commit94dc0c659425f091595dc77c03b9a94f446a65f8 (patch)
tree83f91700fa24e1fb0d10ce052e90ffe358741e16 /src/corelib/io/qwinoverlappedionotifier_p.h
parentd3c24d241e10ae36e768b93607fd3226c48751c6 (diff)
QWinOverlappedIoNotifier: multiple I/O operations on the same handle
When doing multiple I/O operations on the same handle, we get notified for every operations. These must be distinguished by comparing the pointer to the OVERLAPPED struct. We now pass the OVERLAPPED pointer via the notified signal and let the receiver decide if it wants to handle this notification. Change-Id: I4efe70f39c6ae5282b949f2f4b21f6e7dd3df785 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/corelib/io/qwinoverlappedionotifier_p.h')
-rw-r--r--src/corelib/io/qwinoverlappedionotifier_p.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/corelib/io/qwinoverlappedionotifier_p.h b/src/corelib/io/qwinoverlappedionotifier_p.h
index 0659e1b20f..326df584d7 100644
--- a/src/corelib/io/qwinoverlappedionotifier_p.h
+++ b/src/corelib/io/qwinoverlappedionotifier_p.h
@@ -55,6 +55,7 @@
#include <qobject.h>
#include <qt_windows.h>
+#include <qqueue.h>
QT_BEGIN_HEADER
@@ -73,23 +74,35 @@ public:
HANDLE handle() const { return hHandle; }
void setEnabled(bool enabled);
- bool waitForNotified(int msecs);
+ bool waitForNotified(int msecs, OVERLAPPED *overlapped);
Q_SIGNALS:
- void notified(DWORD numberOfBytes, DWORD errorCode);
+ void notified(DWORD numberOfBytes, DWORD errorCode, OVERLAPPED *overlapped);
void _q_notify();
private Q_SLOTS:
- void _q_notified();
+ OVERLAPPED *_q_notified();
private:
- void notify(DWORD numberOfBytes, DWORD errorCode);
+ void notify(DWORD numberOfBytes, DWORD errorCode, OVERLAPPED *overlapped);
private:
HANDLE hHandle;
- HANDLE hEvent;
- DWORD lastNumberOfBytes;
- DWORD lastErrorCode;
+ HANDLE hSemaphore;
+ HANDLE hResultsMutex;
+
+ struct IOResult
+ {
+ IOResult(DWORD n = 0, DWORD e = 0, OVERLAPPED *p = 0)
+ : numberOfBytes(n), errorCode(e), overlapped(p)
+ {}
+
+ DWORD numberOfBytes;
+ DWORD errorCode;
+ OVERLAPPED *overlapped;
+ };
+
+ QQueue<IOResult> results;
friend class QWinIoCompletionPort;
};