MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rpl_info.cc
1 /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #include <my_global.h>
17 #include <sql_priv.h>
18 #include "rpl_info.h"
19 
20 Rpl_info::Rpl_info(const char* type
21 #ifdef HAVE_PSI_INTERFACE
22  ,PSI_mutex_key *param_key_info_run_lock,
23  PSI_mutex_key *param_key_info_data_lock,
24  PSI_mutex_key *param_key_info_sleep_lock,
25  PSI_mutex_key *param_key_info_data_cond,
26  PSI_mutex_key *param_key_info_start_cond,
27  PSI_mutex_key *param_key_info_stop_cond,
28  PSI_mutex_key *param_key_info_sleep_cond
29 #endif
30  ,uint param_id
31  )
33 #ifdef HAVE_PSI_INTERFACE
34  key_info_run_lock(param_key_info_run_lock),
35  key_info_data_lock(param_key_info_data_lock),
36  key_info_sleep_lock(param_key_info_sleep_lock),
37  key_info_data_cond(param_key_info_data_cond),
38  key_info_start_cond(param_key_info_start_cond),
39  key_info_stop_cond(param_key_info_stop_cond),
40  key_info_sleep_cond(param_key_info_sleep_cond),
41 #endif
42  info_thd(0), inited(0), abort_slave(0),
43  slave_running(0), slave_run_id(0),
44  handler(0), internal_id(param_id)
45 {
46 #ifdef HAVE_PSI_INTERFACE
47  mysql_mutex_init(*key_info_run_lock,
48  &run_lock, MY_MUTEX_INIT_FAST);
49  mysql_mutex_init(*key_info_data_lock,
50  &data_lock, MY_MUTEX_INIT_FAST);
51  mysql_mutex_init(*key_info_sleep_lock,
52  &sleep_lock, MY_MUTEX_INIT_FAST);
53  mysql_cond_init(*key_info_data_cond, &data_cond, NULL);
54  mysql_cond_init(*key_info_start_cond, &start_cond, NULL);
55  mysql_cond_init(*key_info_stop_cond, &stop_cond, NULL);
56  mysql_cond_init(*key_info_sleep_cond, &sleep_cond, NULL);
57 #else
58  mysql_mutex_init(NULL, &run_lock, MY_MUTEX_INIT_FAST);
59  mysql_mutex_init(NULL, &data_lock, MY_MUTEX_INIT_FAST);
60  mysql_mutex_init(NULL, &sleep_lock, MY_MUTEX_INIT_FAST);
61  mysql_cond_init(NULL, &data_cond, NULL);
62  mysql_cond_init(NULL, &start_cond, NULL);
63  mysql_cond_init(NULL, &stop_cond, NULL);
64  mysql_cond_init(NULL, &sleep_cond, NULL);
65 #endif
66 }
67 
68 Rpl_info::~Rpl_info()
69 {
70  delete handler;
71 
72  mysql_mutex_destroy(&run_lock);
73  mysql_mutex_destroy(&data_lock);
74  mysql_mutex_destroy(&sleep_lock);
75  mysql_cond_destroy(&data_cond);
76  mysql_cond_destroy(&start_cond);
77  mysql_cond_destroy(&stop_cond);
78  mysql_cond_destroy(&sleep_cond);
79 }