MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_mdl_context_owner.h
1 /* Copyright (c) 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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
15 
16 #ifndef TEST_MDL_CONTEXT_OWNER_INCLUDED
17 #define TEST_MDL_CONTEXT_OWNER_INCLUDED
18 
19 #include <mdl.h>
20 #include <my_pthread.h>
21 
23 {
24 public:
26  : m_current_mutex(NULL)
27  {}
28  virtual void enter_cond(mysql_cond_t *cond,
29  mysql_mutex_t* mutex,
30  const PSI_stage_info *stage,
31  PSI_stage_info *old_stage,
32  const char *src_function,
33  const char *src_file,
34  int src_line)
35  {
36  m_current_mutex= mutex;
37  return;
38  }
39 
40  virtual void exit_cond(const PSI_stage_info *stage,
41  const char *src_function,
42  const char *src_file,
43  int src_line)
44  {
45  mysql_mutex_unlock(m_current_mutex);
46  }
47 
48  virtual int is_killed() { return 0; }
49  virtual THD* get_thd() { return NULL; }
50 
51 private:
52  mysql_mutex_t *m_current_mutex;
53 };
54 
55 #endif // TEST_MDL_CONTEXT_OWNER_INCLUDED