diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-06-01 13:29:40 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-06-01 20:29:10 +0200 |
commit | 3a7bc23a1637696005003163b67328b97c7a1aaa (patch) | |
tree | c56ff4f5d66248f5bad1d45c8a01cde52b812826 /vio/viosocket.c | |
parent | 22ede741f0a4edfcbbae78fd5a23c24056fc7dcb (diff) | |
download | mariadb-git-3a7bc23a1637696005003163b67328b97c7a1aaa.tar.gz |
MDEV-9154 : Remove workarounds (mainly dynamic function loading)
for running obsolete versions of Windows
Diffstat (limited to 'vio/viosocket.c')
-rw-r--r-- | vio/viosocket.c | 49 |
1 files changed, 1 insertions, 48 deletions
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; } |