diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2012-08-28 16:13:03 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2012-08-28 16:13:03 +0200 |
commit | a619bfad30c13207fb0453a85af5740846186900 (patch) | |
tree | 5f6f1c9eddb6fc5b679f5632628837b0deb91b0b | |
parent | 456409022de2aefee0ba77cf756d8611ec88984c (diff) | |
download | mariadb-git-a619bfad30c13207fb0453a85af5740846186900.tar.gz |
Bug#14549809 LINKING PROBLEM IN 5.5.28 BUILDS WITH THREADPOOL PLUGIN
The use of Thread_iterator did not work on windows (linking problems).
Solution: Change the interface between the thread_pool and the server
to only use simple free functions.
This patch is for 5.5 only (mimicks similar solution in 5.6)
-rw-r--r-- | include/mysql/thread_pool_priv.h | 20 | ||||
-rw-r--r-- | sql/mysqld.cc | 15 | ||||
-rw-r--r-- | sql/sql_list.h | 4 |
3 files changed, 21 insertions, 18 deletions
diff --git a/include/mysql/thread_pool_priv.h b/include/mysql/thread_pool_priv.h index d649655bb8e..babe0ab6c08 100644 --- a/include/mysql/thread_pool_priv.h +++ b/include/mysql/thread_pool_priv.h @@ -62,24 +62,8 @@ void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var); ulong thd_get_net_wait_timeout(THD *thd); my_socket thd_get_fd(THD *thd); -/* Interface class for global thread list iteration */ -class Thread_iterator -{ - public: - Thread_iterator() : m_iterator(threads) {} - THD* next() - { - THD* tmp = m_iterator++; - return tmp; - } - private: - /* - Don't allow copying of this class. - */ - Thread_iterator(const Thread_iterator&); - void operator=(const Thread_iterator&); - I_List_iterator<THD> m_iterator; -}; +THD *first_global_thread(); +THD *next_global_thread(THD *thd); /* Print to the MySQL error log */ void sql_print_error(const char *format, ...); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d391918c42c..cfc74804f4e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -601,6 +601,21 @@ I_List<THD> threads; Rpl_filter* rpl_filter; Rpl_filter* binlog_filter; +THD *first_global_thread() +{ + if (threads.is_empty()) + return NULL; + return threads.head(); +} + +THD *next_global_thread(THD *thd) +{ + if (threads.is_last(thd)) + return NULL; + struct ilink *next= thd->next; + return static_cast<THD*>(next); +} + struct system_variables global_system_variables; struct system_variables max_system_variables; struct system_status_var global_status_var; diff --git a/sql/sql_list.h b/sql/sql_list.h index 769f44274de..c68ecc07e11 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -585,6 +585,9 @@ public: inline void empty() { first= &last; last.prev= &first; } base_ilist() { empty(); } inline bool is_empty() { return first == &last; } + // Returns true if p is the last "real" object in the list, + // i.e. p->next points to the sentinel. + inline bool is_last(ilink *p) { return p->next == NULL || p->next == &last; } inline void append(ilink *a) { first->prev= &a->next; @@ -660,6 +663,7 @@ class I_List :private base_ilist { public: I_List() :base_ilist() {} + inline bool is_last(T *p) { return base_ilist::is_last(p); } inline void empty() { base_ilist::empty(); } inline bool is_empty() { return base_ilist::is_empty(); } inline void append(T* a) { base_ilist::append(a); } |