mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / sql / debug_sync.h
blobaf5be4b422e7d33163b22dd0a5ad39376eff9801
1 #ifndef DEBUG_SYNC_INCLUDED
2 #define DEBUG_SYNC_INCLUDED
4 /* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
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.
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.
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
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
19 /**
20 @file
22 Declarations for the Debug Sync Facility. See debug_sync.cc for details.
25 #ifdef USE_PRAGMA_INTERFACE
26 #pragma interface /* gcc class implementation */
27 #endif
29 #include <my_global.h>
31 class THD;
33 #if defined(ENABLED_DEBUG_SYNC)
35 /* Macro to be put in the code at synchronization points. */
36 #define DEBUG_SYNC(_thd_, _sync_point_name_) \
37 do { if (unlikely(opt_debug_sync_timeout)) \
38 debug_sync(_thd_, STRING_WITH_LEN(_sync_point_name_)); \
39 } while (0)
41 /* Command line option --debug-sync-timeout. See mysqld.cc. */
42 extern uint opt_debug_sync_timeout;
44 /* Default WAIT_FOR timeout if command line option is given without argument. */
45 #define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
47 /* Debug Sync prototypes. See debug_sync.cc. */
48 extern int debug_sync_init(void);
49 extern void debug_sync_end(void);
50 extern void debug_sync_init_thread(THD *thd);
51 extern void debug_sync_end_thread(THD *thd);
52 extern void debug_sync(THD *thd, const char *sync_point_name, size_t name_len);
53 extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
55 #else /* defined(ENABLED_DEBUG_SYNC) */
57 #define DEBUG_SYNC(_thd_, _sync_point_name_) /* disabled DEBUG_SYNC */
59 #endif /* defined(ENABLED_DEBUG_SYNC) */
61 #endif /* DEBUG_SYNC_INCLUDED */