diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /storage/perfschema/mysqld_thd_manager.cc | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/perfschema/mysqld_thd_manager.cc')
-rw-r--r-- | storage/perfschema/mysqld_thd_manager.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/storage/perfschema/mysqld_thd_manager.cc b/storage/perfschema/mysqld_thd_manager.cc new file mode 100644 index 00000000..61282b7e --- /dev/null +++ b/storage/perfschema/mysqld_thd_manager.cc @@ -0,0 +1,39 @@ +#include "mysqld_thd_manager.h" +#include "sql_class.h" + +static Global_THD_manager manager; +Global_THD_manager* Global_THD_manager::get_instance() +{ + return &manager; +} + +struct find_thd_arg +{ + Find_THD_Impl *func; + THD *cur; +}; + +static my_bool find_thd_cb(THD *tmp, find_thd_arg *arg) +{ + arg->cur= tmp; + return (*arg->func)(tmp); +} + +THD* Global_THD_manager::find_thd(Find_THD_Impl *func) +{ + find_thd_arg arg= {func, NULL}; + if (THD_list_iterator::iterator()->iterate(find_thd_cb, &arg)) + return arg.cur; + return NULL; +} + +static my_bool do_for_all_cb(THD *tmp, Do_THD_Impl *arg) +{ + (*arg)(tmp); + return 0; +} + +void Global_THD_manager::do_for_all_thd(Do_THD_Impl *arg) +{ + THD_list_iterator::iterator()->iterate(do_for_all_cb, arg); +} |