MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
debug_sync.h
Go to the documentation of this file.
1 #ifndef DEBUG_SYNC_INCLUDED
2 #define DEBUG_SYNC_INCLUDED
3 
4 /* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; version 2 of the License.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software Foundation,
17  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
18 
25 #include <my_global.h>
26 
27 class THD;
28 
29 #if defined(ENABLED_DEBUG_SYNC)
30 
31 /* Macro to be put in the code at synchronization points. */
32 #define DEBUG_SYNC(_thd_, _sync_point_name_) \
33  do { if (unlikely(opt_debug_sync_timeout)) \
34  debug_sync(_thd_, STRING_WITH_LEN(_sync_point_name_)); \
35  } while (0)
36 
37 /* Command line option --debug-sync-timeout. See mysqld.cc. */
38 extern MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout;
39 
40 /* Default WAIT_FOR timeout if command line option is given without argument. */
41 #define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
42 
43 /* Debug Sync prototypes. See debug_sync.cc. */
44 extern int debug_sync_init(void);
45 extern void debug_sync_end(void);
46 extern void debug_sync_init_thread(THD *thd);
47 extern void debug_sync_end_thread(THD *thd);
48 extern void debug_sync(THD *thd, const char *sync_point_name, size_t name_len);
49 extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
50 
51 #else /* defined(ENABLED_DEBUG_SYNC) */
52 
53 #define DEBUG_SYNC(_thd_, _sync_point_name_) /* disabled DEBUG_SYNC */
54 
55 #endif /* defined(ENABLED_DEBUG_SYNC) */
56 
57 #endif /* DEBUG_SYNC_INCLUDED */