diff options
Diffstat (limited to 'sql/scheduler.h')
-rw-r--r-- | sql/scheduler.h | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/sql/scheduler.h b/sql/scheduler.h index a04a32d2262..03e1ad385c1 100644 --- a/sql/scheduler.h +++ b/sql/scheduler.h @@ -24,13 +24,16 @@ #pragma interface #endif +#include <my_global.h> + class THD; /* Functions used when manipulating threads */ struct scheduler_functions { - uint max_threads; + uint max_threads, *connection_count; + ulong *max_connections; bool (*init)(void); bool (*init_new_connection_thread)(void); void (*add_connection)(THD *thd); @@ -69,12 +72,16 @@ enum scheduler_types SCHEDULER_TYPES_COUNT }; -void one_thread_per_connection_scheduler(); -void one_thread_scheduler(); +void one_thread_per_connection_scheduler(scheduler_functions *func, + ulong *arg_max_connections, uint *arg_connection_count); +void one_thread_scheduler(scheduler_functions *func); -/* - To be used for pool-of-threads (implemeneted differently on various OSs) -*/ +#if defined(HAVE_LIBEVENT) && !defined(EMBEDDED_LIBRARY) + +#define HAVE_POOL_OF_THREADS 1 + +struct event; + class thd_scheduler { public: @@ -90,17 +97,28 @@ public: */ PSI_thread *m_psi; - void *data; /* scheduler-specific data structure */ + bool logged_in; + struct event* io_event; + LIST list; + bool thread_attached; /* Indicates if THD is attached to the OS thread */ thd_scheduler(); ~thd_scheduler(); + bool init(THD* parent_thd); + bool thread_attach(); + void thread_detach(); }; -void *thd_get_scheduler_data(THD *thd); -void thd_set_scheduler_data(THD *thd, void *data); -PSI_thread* thd_get_psi(THD *thd); -void thd_set_psi(THD *thd, PSI_thread *psi); +void pool_of_threads_scheduler(scheduler_functions* func); +#else -extern scheduler_functions *thread_scheduler; +#define pool_of_threads_scheduler(A) \ + one_thread_per_connection_scheduler(A, &max_connections, \ + &connection_count) + +class thd_scheduler +{}; + +#endif #endif |