You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1 KiB

  1. #ifndef DEBUG_SYNC_INCLUDED
  2. #define DEBUG_SYNC_INCLUDED
  3. /* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; version 2 of the License.
  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. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  14. /**
  15. @file
  16. Declarations for the Debug Sync Facility. See debug_sync.cc for details.
  17. */
  18. #ifdef USE_PRAGMA_INTERFACE
  19. #pragma interface /* gcc class implementation */
  20. #endif
  21. #include <my_global.h>
  22. class THD;
  23. #if defined(ENABLED_DEBUG_SYNC)
  24. /* Macro to be put in the code at synchronization points. */
  25. #define DEBUG_SYNC(_thd_, _sync_point_name_) \
  26. do { if (unlikely(opt_debug_sync_timeout)) \
  27. debug_sync(_thd_, STRING_WITH_LEN(_sync_point_name_)); \
  28. } while (0)
  29. /* Command line option --debug-sync-timeout. See mysqld.cc. */
  30. extern uint opt_debug_sync_timeout;
  31. /* Default WAIT_FOR timeout if command line option is given without argument. */
  32. #define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
  33. /* Debug Sync prototypes. See debug_sync.cc. */
  34. extern int debug_sync_init(void);
  35. extern void debug_sync_end(void);
  36. extern void debug_sync_init_thread(THD *thd);
  37. extern void debug_sync_end_thread(THD *thd);
  38. extern void debug_sync(THD *thd, const char *sync_point_name, size_t name_len);
  39. extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
  40. #else /* defined(ENABLED_DEBUG_SYNC) */
  41. #define DEBUG_SYNC(_thd_, _sync_point_name_) /* disabled DEBUG_SYNC */
  42. #endif /* defined(ENABLED_DEBUG_SYNC) */
  43. #endif /* DEBUG_SYNC_INCLUDED */