Remove qt_cancelIo helper function
We can now directly use CancelIoEx. The fallback to CancelIo was needed for supporting Windows XP. Change-Id: I24a53a774caf695e6006f24a914abaa5ab204035 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
af6b700bb8
commit
fade295814
@ -71,21 +71,6 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
|
||||
this, &QWindowsPipeReader::emitPendingReadyRead, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped)
|
||||
{
|
||||
typedef BOOL (WINAPI *PtrCancelIoEx)(HANDLE, LPOVERLAPPED);
|
||||
static PtrCancelIoEx ptrCancelIoEx = 0;
|
||||
if (!ptrCancelIoEx) {
|
||||
HMODULE kernel32 = GetModuleHandleA("kernel32");
|
||||
if (kernel32)
|
||||
ptrCancelIoEx = PtrCancelIoEx(GetProcAddress(kernel32, "CancelIoEx"));
|
||||
}
|
||||
if (ptrCancelIoEx)
|
||||
return ptrCancelIoEx(handle, overlapped);
|
||||
else
|
||||
return CancelIo(handle);
|
||||
}
|
||||
|
||||
QWindowsPipeReader::~QWindowsPipeReader()
|
||||
{
|
||||
stop();
|
||||
@ -110,7 +95,7 @@ void QWindowsPipeReader::stop()
|
||||
{
|
||||
stopped = true;
|
||||
if (readSequenceStarted) {
|
||||
if (!qt_cancelIo(handle, &overlapped)) {
|
||||
if (!CancelIoEx(handle, &overlapped)) {
|
||||
const DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_NOT_FOUND) {
|
||||
qErrnoWarning(dwError, "QWindowsPipeReader: qt_cancelIo on handle %x failed.",
|
||||
|
@ -42,9 +42,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
extern bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped); // from qwindowspipereader.cpp
|
||||
|
||||
|
||||
QWindowsPipeWriter::Overlapped::Overlapped(QWindowsPipeWriter *pipeWriter)
|
||||
: pipeWriter(pipeWriter)
|
||||
{
|
||||
@ -209,7 +206,7 @@ void QWindowsPipeWriter::stop()
|
||||
{
|
||||
stopped = true;
|
||||
if (writeSequenceStarted) {
|
||||
if (!qt_cancelIo(handle, &overlapped)) {
|
||||
if (!CancelIoEx(handle, &overlapped)) {
|
||||
const DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_NOT_FOUND) {
|
||||
qErrnoWarning(dwError, "QWindowsPipeWriter: qt_cancelIo on handle %x failed.",
|
||||
|
Loading…
Reference in New Issue
Block a user