From 3f619478f796eddbba6e39502fe941b285dd97b1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:00:34 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- storage/perfschema/mysqld_thd_manager.cc | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 storage/perfschema/mysqld_thd_manager.cc (limited to 'storage/perfschema/mysqld_thd_manager.cc') 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); +} -- cgit v1.2.3