File: mysqld_thd_manager.cc

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (39 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
}