My Project
debug_sync.h
Go to the documentation of this file.
00001 #ifndef DEBUG_SYNC_INCLUDED
00002 #define DEBUG_SYNC_INCLUDED
00003 
00004 /* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; version 2 of the License.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software Foundation,
00017    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
00018 
00025 #include <my_global.h>
00026 
00027 class THD;
00028 
00029 #if defined(ENABLED_DEBUG_SYNC)
00030 
00031 /* Macro to be put in the code at synchronization points. */
00032 #define DEBUG_SYNC(_thd_, _sync_point_name_)                            \
00033           do { if (unlikely(opt_debug_sync_timeout))                    \
00034                debug_sync(_thd_, STRING_WITH_LEN(_sync_point_name_));   \
00035              } while (0)
00036 
00037 /* Command line option --debug-sync-timeout. See mysqld.cc. */
00038 extern MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout;
00039 
00040 /* Default WAIT_FOR timeout if command line option is given without argument. */
00041 #define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
00042 
00043 /* Debug Sync prototypes. See debug_sync.cc. */
00044 extern int  debug_sync_init(void);
00045 extern void debug_sync_end(void);
00046 extern void debug_sync_init_thread(THD *thd);
00047 extern void debug_sync_end_thread(THD *thd);
00048 extern void debug_sync(THD *thd, const char *sync_point_name, size_t name_len);
00049 extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
00050 
00051 #else /* defined(ENABLED_DEBUG_SYNC) */
00052 
00053 #define DEBUG_SYNC(_thd_, _sync_point_name_)    /* disabled DEBUG_SYNC */
00054 
00055 #endif /* defined(ENABLED_DEBUG_SYNC) */
00056 
00057 #endif /* DEBUG_SYNC_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines