26#ifndef ROUTER_SRC_JIT_EXECUTOR_INCLUDE_MYSQLROUTER_JIT_EXECUTOR_CONTEXT_POOL_H_
27#define ROUTER_SRC_JIT_EXECUTOR_INCLUDE_MYSQLROUTER_JIT_EXECUTOR_CONTEXT_POOL_H_
30#include <condition_variable>
52class PooledContextHandle;
60 std::shared_ptr<PooledContextHandle> get_context();
66 void release_thread();
68 void increase_active_items();
69 void decrease_active_items();
87 bool m_teardown =
false;
89 size_t m_active_items = 0;
90 size_t m_created_items = 0;
92 std::atomic_bool m_forbid_context_creation =
false;
int destroy(azio_stream *s)
Definition: azio.cc:372
Specialization of the Polyglot_common_context to provide MRS specific logging functions as well as th...
Definition: jit_executor_common_context.h:48
Definition: jit_executor_context_pool.h:54
std::unique_ptr< std::thread > m_release_thread
Definition: jit_executor_context_pool.h:83
void release(IContext *ctx)
Definition: jit_executor_context_pool.cc:70
std::condition_variable m_item_availability
Definition: jit_executor_context_pool.h:86
std::deque< IContext * > m_items
Definition: jit_executor_context_pool.h:88
CommonContext * m_common_context
Definition: jit_executor_context_pool.h:81
mysql_harness::WaitingMPSCQueue< IContext * > m_release_queue
Definition: jit_executor_context_pool.h:82
std::mutex m_mutex
Definition: jit_executor_context_pool.h:85
Base handler for Jit Executor Context instances.
Definition: jit_executor_context_handle.h:36
Definition: jit_executor_context.h:40
A wrapper that will return a context to the pool as soon as it is released.
Definition: jit_executor_context_pool.h:98
IContext * m_context
Definition: jit_executor_context_pool.h:108
IContext * get() override
Definition: jit_executor_context_pool.h:104
~PooledContextHandle() override
Definition: jit_executor_context_pool.h:102
PooledContextHandle(ContextPool *pool, IContext *ctx)
Definition: jit_executor_context_pool.h:100
ContextPool * m_pool
Definition: jit_executor_context_pool.h:107
provide waiting pop and push operator to thread-safe queues.
Definition: waiting_queue_adaptor.h:40
Logging interface for using and extending the logging subsystem.
#define IMPORT_LOG_FUNCTIONS()
convenience macro to avoid common boilerplate
Definition: logging.h:331
void teardown()
Definition: components.cc:74
Definition: jit_executor_callbacks.h:36
static mysql_service_status_t get(THD **thd) noexcept
Definition: mysql_current_thread_reader_all_empty.cc:31
static mysql_service_status_t create(my_h_string *) noexcept
Definition: mysql_string_all_empty.cc:43