qt5base-lts/tests/auto/corelib/kernel/qwineventnotifier
Alex Trotsenko cdbd68fc2f Allow QWinEventNotifier to coexist with waiting functions
Many subclasses of QIODevice have a functionality to block execution
until some asynchronous I/O operation completes. In case we are using
QWinEventNotifier, a typical reimplemented waitFor{ReadyRead
|BytesWritten}() function could look like:

  if (WaitForSingleObject(notifier.handle(),...) == WAIT_OBJECT_0) {
      notifier.setEnabled(false);
      ResetEvent(notifier.handle());

      bool res = GetOverlappedResult(...);
      ...
      return true;
  }

Despite the fact that the operation ends synchronously, it leaves the
notifier in a state that indicates it has received the event, so its
next call to setEnabled(true) will produce a fake notification.

So, we should reset a notifier's history before enabling it again.

Change-Id: I62a9dd809ce6a7a40e9d8038f2a49299b36f8142
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-27 15:08:46 +00:00
..
.gitignore Moving relevant tests to corelib/kernel 2011-09-01 12:42:14 +02:00
qwineventnotifier.pro Tests: Remove CONFIG += parallel_test. 2015-09-05 07:16:50 +00:00
tst_qwineventnotifier.cpp Allow QWinEventNotifier to coexist with waiting functions 2018-03-27 15:08:46 +00:00