CUBRID Engine  latest
internal_tasks_worker_pool.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * internal_tasks_worker_pool.cpp
21  */
22 
24 #include "thread_worker_pool.hpp"
25 
26 namespace cubthread
27 {
28  constexpr size_t WORKER_COUNT = 2;
29  constexpr size_t TASK_COUNT = 10;
30  constexpr size_t CORE_COUNT = 1;
31  constexpr bool ENABLE_LOGGING = true;
32 
34 
35  namespace internal_tasks_worker_pool
36  {
37  void initialize ()
38  {
39  if (instance != NULL)
40  {
41  return;
42  }
43 
44  instance = cubthread::get_manager ()->create_worker_pool (WORKER_COUNT,
45  TASK_COUNT, "internal_tasks_worker_pool", NULL, CORE_COUNT, ENABLE_LOGGING);
46  }
47 
49  {
50  assert (instance != NULL);
51  return instance;
52  }
53 
54  void finalize ()
55  {
56  delete instance;
57  instance = NULL;
58  }
59  }
60 }
constexpr size_t WORKER_COUNT
constexpr size_t CORE_COUNT
entry_workpool * create_worker_pool(std::size_t pool_size, std::size_t task_max_count, const char *name, entry_manager *context_manager, std::size_t core_count, bool debug_logging, bool pool_threads=false, wait_seconds wait_for_task_time=std::chrono::seconds(5))
manager * get_manager(void)
#define assert(x)
#define NULL
Definition: freelistheap.h:34
constexpr size_t TASK_COUNT
entry_workpool * instance
constexpr bool ENABLE_LOGGING