diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-07-16 23:33:31 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-07-16 23:33:31 +0000 |
commit | 453c9e163acb604aab4deddd45479dcc68c0d9de (patch) | |
tree | 068fcb88da1f0e346f20eb28b1ece45b27def299 /sql/threadpool_win.cc | |
parent | 139534a50b91b2b90baab33ad997fbd09414e48c (diff) | |
download | mariadb-git-10.2-wlad-threadpool.tar.gz |
fix connection counter in unix pool, return error code from tp_init instead of exit()10.2-wlad-threadpool
Diffstat (limited to 'sql/threadpool_win.cc')
-rw-r--r-- | sql/threadpool_win.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index 2c012a9e77b..cc8b3081ff6 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -443,6 +443,9 @@ static void CALLBACK work_callback(PTP_CALLBACK_INSTANCE instance, PVOID context } TP_pool_win::TP_pool_win() +{} + +int TP_pool_win::init() { fls= FlsAlloc(thread_destructor); pool= CreateThreadpool(NULL); @@ -452,7 +455,7 @@ TP_pool_win::TP_pool_win() sql_print_error("Can't create threadpool. " "CreateThreadpool() failed with %d. Likely cause is memory pressure", GetLastError()); - exit(1); + return -1; } InitializeThreadpoolEnvironment(&callback_environ); @@ -486,6 +489,7 @@ TP_pool_win::TP_pool_win() "SetThreadpoolStackInformation"); } } + return 0; } @@ -494,6 +498,8 @@ TP_pool_win::TP_pool_win() */ TP_pool_win::~TP_pool_win() { + if (!pool) + return; DestroyThreadpoolEnvironment(&callback_environ); SetThreadpoolThreadMaximum(pool, 0); CloseThreadpool(pool); |