summaryrefslogtreecommitdiff
path: root/storage/innobase/os
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-09-13 18:23:14 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2016-09-13 18:23:14 +0000
commit7c6037ceda560a8701f19aa635e176aae6d3ccee (patch)
tree3db57ea26cda94941882b822d3a7bc1bd64d84a1 /storage/innobase/os
parentbc526a55742af9894d5a6440868e9011485d9029 (diff)
downloadmariadb-git-7c6037ceda560a8701f19aa635e176aae6d3ccee.tar.gz
Windows : CloseHandle() returned by CreateThread().
Don't wait until os_thread_exit to close it. Remove code from innodb_shutdown to close handles on Windows.
Diffstat (limited to 'storage/innobase/os')
-rw-r--r--storage/innobase/os/os0thread.cc29
1 files changed, 3 insertions, 26 deletions
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index 811bd87cef7..2d9abaa6c52 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -45,16 +45,6 @@ SysMutex thread_mutex;
/** Number of threads active. */
ulint os_thread_count;
-#ifdef _WIN32
-typedef std::map<
- DWORD,
- HANDLE,
- std::less<DWORD>,
- ut_allocator<std::pair<const DWORD, HANDLE> > > WinThreadMap;
-/** This STL map remembers the initial handle returned by CreateThread
-so that it can be closed when the thread exits. */
-static WinThreadMap win_thread_map;
-#endif /* _WIN32 */
/***************************************************************//**
Compares two thread ids for equality.
@@ -145,22 +135,15 @@ os_thread_create_func(
ib::fatal() << "CreateThread returned " << GetLastError();
}
- mutex_enter(&thread_mutex);
-
- std::pair<WinThreadMap::iterator, bool> ret;
-
- ret = win_thread_map.insert(
- std::pair<DWORD, HANDLE>(new_thread_id, handle));
+ CloseHandle(handle);
- ut_ad((*ret.first).first == new_thread_id);
- ut_ad((*ret.first).second == handle);
- ut_a(ret.second == true); /* true means thread_id was new */
+ mutex_enter(&thread_mutex);
os_thread_count++;
mutex_exit(&thread_mutex);
- return((os_thread_t)handle);
+ return((os_thread_t)new_thread_id);
#else /* _WIN32 else */
pthread_attr_t attr;
@@ -208,12 +191,6 @@ os_thread_exit()
os_thread_count--;
#ifdef _WIN32
- DWORD win_thread_id = GetCurrentThreadId();
- HANDLE handle = win_thread_map[win_thread_id];
- CloseHandle(handle);
- size_t ret = win_thread_map.erase(win_thread_id);
- ut_a(ret == 1);
-
mutex_exit(&thread_mutex);
ExitThread(0);