summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-06-01 13:29:40 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2016-06-01 20:29:10 +0200
commit3a7bc23a1637696005003163b67328b97c7a1aaa (patch)
treec56ff4f5d66248f5bad1d45c8a01cde52b812826 /vio
parent22ede741f0a4edfcbbae78fd5a23c24056fc7dcb (diff)
downloadmariadb-git-3a7bc23a1637696005003163b67328b97c7a1aaa.tar.gz
MDEV-9154 : Remove workarounds (mainly dynamic function loading)
for running obsolete versions of Windows
Diffstat (limited to 'vio')
-rw-r--r--vio/vio.c2
-rw-r--r--vio/viosocket.c49
2 files changed, 2 insertions, 49 deletions
diff --git a/vio/vio.c b/vio/vio.c
index e3bc8ca8ab8..77a58a8272c 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -67,7 +67,7 @@ int vio_shared_memory_shutdown(Vio *vio, int how)
int vio_pipe_shutdown(Vio *vio, int how)
{
- return cancel_io(vio->hPipe, vio->thread_id);
+ return CancelIoEx(vio->hPipe, NULL);
}
#endif
diff --git a/vio/viosocket.c b/vio/viosocket.c
index e724165612c..a33de48c020 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -299,59 +299,12 @@ size_t vio_write(Vio *vio, const uchar* buf, size_t size)
DBUG_RETURN(ret);
}
-#ifdef _WIN32
-static void CALLBACK cancel_io_apc(ULONG_PTR data)
-{
- CancelIo((HANDLE)data);
-}
-
-/*
- Cancel IO on Windows.
-
- On XP, issue CancelIo as asynchronous procedure call to the thread
- that started IO. On Vista+, simpler cancelation is done with
- CancelIoEx.
-*/
-
-int cancel_io(HANDLE handle, DWORD thread_id)
-{
- static BOOL (WINAPI *fp_CancelIoEx) (HANDLE, OVERLAPPED *);
- static volatile int first_time= 1;
- int rc;
- HANDLE thread_handle;
-
- if (first_time)
- {
- /* Try to load CancelIoEx using GetProcAddress */
- InterlockedCompareExchangePointer((volatile void *)&fp_CancelIoEx,
- GetProcAddress(GetModuleHandle("kernel32"), "CancelIoEx"), NULL);
- first_time =0;
- }
-
- if (fp_CancelIoEx)
- {
- return fp_CancelIoEx(handle, NULL)? 0 :-1;
- }
-
- thread_handle= OpenThread(THREAD_SET_CONTEXT, FALSE, thread_id);
- if (thread_handle)
- {
- rc= QueueUserAPC(cancel_io_apc, thread_handle, (ULONG_PTR)handle);
- CloseHandle(thread_handle);
- }
- return rc;
-
-}
-#endif
-
-
int vio_socket_shutdown(Vio *vio, int how)
{
int ret= shutdown(mysql_socket_getfd(vio->mysql_socket), how);
#ifdef _WIN32
/* Cancel possible IO in progress (shutdown does not do that on Windows). */
- (void) cancel_io((HANDLE) mysql_socket_getfd(vio->mysql_socket),
- vio->thread_id);
+ (void) CancelIoEx((HANDLE)mysql_socket_getfd(vio->mysql_socket), NULL);
#endif
return ret;
}