diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-12-08 19:17:49 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-12-08 19:17:49 +0100 |
commit | e91bbca5fb080a8d988c156d78c7dc1b1daaad82 (patch) | |
tree | edeb15da451e956ae0d6874657c910ab0df111f8 /sql/scheduler.h | |
parent | 5e7b949e61f4330e27013c8ec81fa3d450e5dce6 (diff) | |
download | mariadb-git-e91bbca5fb080a8d988c156d78c7dc1b1daaad82.tar.gz |
Initial threadpool implementation for MariaDB 5.5
Diffstat (limited to 'sql/scheduler.h')
-rw-r--r-- | sql/scheduler.h | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/sql/scheduler.h b/sql/scheduler.h index 03e1ad385c1..c91df8512ab 100644 --- a/sql/scheduler.h +++ b/sql/scheduler.h @@ -76,13 +76,11 @@ void one_thread_per_connection_scheduler(scheduler_functions *func, ulong *arg_max_connections, uint *arg_connection_count); void one_thread_scheduler(scheduler_functions *func); -#if defined(HAVE_LIBEVENT) && !defined(EMBEDDED_LIBRARY) -#define HAVE_POOL_OF_THREADS 1 - -struct event; - -class thd_scheduler +/* + To be used for pool-of-threads (implemeneted differently on various OSs) +*/ +struct thd_scheduler { public: /* @@ -96,29 +94,33 @@ public: differently. */ PSI_thread *m_psi; - - 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 *data; /* scheduler-specific data structure */ +#ifndef DBUG_OFF + bool set_explain; + char dbug_explain[512]; +#endif }; -void pool_of_threads_scheduler(scheduler_functions* func); -#else +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); -#define pool_of_threads_scheduler(A) \ - one_thread_per_connection_scheduler(A, &max_connections, \ - &connection_count) +/* Common thread pool routines, suitable for different implementations */ +extern void threadpool_remove_connection(THD *thd); +extern int threadpool_process_request(THD *thd); +extern int threadpool_add_connection(THD *thd); -class thd_scheduler -{}; -#endif +extern scheduler_functions *thread_scheduler; +#endif /* SCHEDULER_INCLUDED */ +#if !defined(EMBEDDED_LIBRARY) +#define HAVE_POOL_OF_THREADS 1 +void pool_of_threads_scheduler(scheduler_functions* func, + ulong *arg_max_connections, + uint *arg_connection_count); +#else +#define pool_of_threads_scheduler(A,B,C) \ + one_thread_per_connection_scheduler(A, B, C) #endif |