MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mysql_idle.h
Go to the documentation of this file.
1 /* Copyright (c) 2011, 2012, 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 Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 #ifndef MYSQL_IDLE_H
17 #define MYSQL_IDLE_H
18 
24 #include "mysql/psi/psi.h"
25 
40 #ifdef HAVE_PSI_IDLE_INTERFACE
41  #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \
42  LOCKER= inline_mysql_start_idle_wait(STATE, __FILE__, __LINE__)
43 #else
44  #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \
45  do {} while (0)
46 #endif
47 
55 #ifdef HAVE_PSI_IDLE_INTERFACE
56  #define MYSQL_END_IDLE_WAIT(LOCKER) \
57  inline_mysql_end_idle_wait(LOCKER)
58 #else
59  #define MYSQL_END_IDLE_WAIT(LOCKER) \
60  do {} while (0)
61 #endif
62 
63 #ifdef HAVE_PSI_IDLE_INTERFACE
64 
68 static inline struct PSI_idle_locker *
69 inline_mysql_start_idle_wait(PSI_idle_locker_state *state,
70  const char *src_file, int src_line)
71 {
72  struct PSI_idle_locker *locker;
73  locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line);
74  return locker;
75 }
76 
81 static inline void
82 inline_mysql_end_idle_wait(struct PSI_idle_locker *locker)
83 {
84  if (likely(locker != NULL))
85  PSI_IDLE_CALL(end_idle_wait)(locker);
86 }
87 #endif
88 
91 #endif
92