diff options
| author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-07-16 00:49:45 +0000 |
|---|---|---|
| committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-07-16 00:49:45 +0000 |
| commit | a170bd337e84fd13fa7e64cbb38d6a8baa2a2244 (patch) | |
| tree | bf78c6d79a7ea58482bb95a7c69a9e8d75aca028 /sql/threadpool_common.cc | |
| parent | 627c5d9b57c461cda64f703c2e683c2a0b6ac53b (diff) | |
| download | mariadb-git-a170bd337e84fd13fa7e64cbb38d6a8baa2a2244.tar.gz | |
Unix threadpool refactoring (Actually makes Windows possible to use generic implementation
Diffstat (limited to 'sql/threadpool_common.cc')
| -rw-r--r-- | sql/threadpool_common.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 7e3492ae3ef..730ea2bd365 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -344,15 +344,17 @@ static bool tp_end_thread(THD *, bool) return 0; } -TP_pool *pool; +static TP_pool *pool; static bool tp_init() { + #ifdef _WIN32 pool = new (std::nothrow) TP_pool_win; return 0; #else -#error No threadpool + pool= new (std::nothrow) TP_pool_unix; + return 0; #endif } @@ -389,6 +391,19 @@ void tp_set_max_threads(uint val) pool->set_max_threads(val); } +void tp_set_threadpool_size(uint val) +{ + if (pool) + pool->set_pool_size(val); +} + + +void tp_set_threadpool_stall_limit(uint val) +{ + if (pool) + pool->set_stall_limit(val); +} + void tp_timeout_handler(TP_connection *c) { @@ -433,6 +448,7 @@ static void tp_end() delete pool; } + static scheduler_functions tp_scheduler_functions= { 0, // max_threads |
