Drizzled Public API Documentation

sync0sync.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
00004 Copyright (C) 2008, Google Inc.
00005 
00006 Portions of this file contain modifications contributed and copyrighted by
00007 Google, Inc. Those modifications are gratefully acknowledged and are described
00008 briefly in the InnoDB documentation. The contributions by Google are
00009 incorporated with their permission, and subject to the conditions contained in
00010 the file COPYING.Google.
00011 
00012 This program is free software; you can redistribute it and/or modify it under
00013 the terms of the GNU General Public License as published by the Free Software
00014 Foundation; version 2 of the License.
00015 
00016 This program is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License along with
00021 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
00022 St, Fifth Floor, Boston, MA 02110-1301 USA
00023 
00024 *****************************************************************************/
00025 
00026 /**************************************************/
00033 #pragma once
00034 #ifndef sync0sync_h
00035 #define sync0sync_h
00036 
00037 #include "univ.i"
00038 #include "sync0types.h"
00039 #include "ut0lst.h"
00040 #include "ut0mem.h"
00041 #include "os0thread.h"
00042 #include "os0sync.h"
00043 #include "sync0arr.h"
00044 
00045 #if  defined(UNIV_DEBUG) && !defined(UNIV_HOTBACKUP)
00046 extern my_bool  timed_mutexes;
00047 #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
00048 
00049 #ifdef HAVE_WINDOWS_ATOMICS
00050 typedef LONG lock_word_t; 
00052 #else
00053 typedef byte lock_word_t;
00054 #endif
00055 
00056 #if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
00057 /* There are mutexes/rwlocks that we want to exclude from
00058 instrumentation even if their corresponding performance schema
00059 define is set. And this PFS_NOT_INSTRUMENTED is used
00060 as the key value to dentify those objects that would
00061 be excluded from instrumentation. */
00062 # define PFS_NOT_INSTRUMENTED   ULINT32_UNDEFINED
00063 
00064 # define PFS_IS_INSTRUMENTED(key) ((key) != PFS_NOT_INSTRUMENTED)
00065 
00066 /* By default, buffer mutexes and rwlocks will be excluded from
00067 instrumentation due to their large number of instances. */
00068 # define PFS_SKIP_BUFFER_MUTEX_RWLOCK
00069 
00070 #endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
00071 
00072 #ifdef UNIV_PFS_MUTEX
00073 /* Key defines to register InnoDB mutexes with performance schema */
00074 extern mysql_pfs_key_t  autoinc_mutex_key;
00075 extern mysql_pfs_key_t  btr_search_enabled_mutex_key;
00076 extern mysql_pfs_key_t  buffer_block_mutex_key;
00077 extern mysql_pfs_key_t  buf_pool_mutex_key;
00078 extern mysql_pfs_key_t  buf_pool_zip_mutex_key;
00079 extern mysql_pfs_key_t  cache_last_read_mutex_key;
00080 extern mysql_pfs_key_t  dict_foreign_err_mutex_key;
00081 extern mysql_pfs_key_t  dict_sys_mutex_key;
00082 extern mysql_pfs_key_t  file_format_max_mutex_key;
00083 extern mysql_pfs_key_t  fil_system_mutex_key;
00084 extern mysql_pfs_key_t  flush_list_mutex_key;
00085 extern mysql_pfs_key_t  hash_table_mutex_key;
00086 extern mysql_pfs_key_t  ibuf_bitmap_mutex_key;
00087 extern mysql_pfs_key_t  ibuf_mutex_key;
00088 extern mysql_pfs_key_t  ibuf_pessimistic_insert_mutex_key;
00089 extern mysql_pfs_key_t  log_sys_mutex_key;
00090 extern mysql_pfs_key_t  log_flush_order_mutex_key;
00091 extern mysql_pfs_key_t  kernel_mutex_key;
00092 extern mysql_pfs_key_t  commit_id_mutex_key;
00093 # ifdef UNIV_MEM_DEBUG
00094 extern mysql_pfs_key_t  mem_hash_mutex_key;
00095 # endif /* UNIV_MEM_DEBUG */
00096 extern mysql_pfs_key_t  mem_pool_mutex_key;
00097 extern mysql_pfs_key_t  mutex_list_mutex_key;
00098 extern mysql_pfs_key_t  purge_sys_mutex_key;
00099 extern mysql_pfs_key_t  recv_sys_mutex_key;
00100 extern mysql_pfs_key_t  rseg_mutex_key;
00101 # ifdef UNIV_SYNC_DEBUG
00102 extern mysql_pfs_key_t  rw_lock_debug_mutex_key;
00103 # endif /* UNIV_SYNC_DEBUG */
00104 extern mysql_pfs_key_t  rw_lock_list_mutex_key;
00105 extern mysql_pfs_key_t  rw_lock_mutex_key;
00106 extern mysql_pfs_key_t  srv_dict_tmpfile_mutex_key;
00107 extern mysql_pfs_key_t  srv_innodb_monitor_mutex_key;
00108 extern mysql_pfs_key_t  srv_misc_tmpfile_mutex_key;
00109 extern mysql_pfs_key_t  srv_monitor_file_mutex_key;
00110 extern mysql_pfs_key_t  syn_arr_mutex_key;
00111 # ifdef UNIV_SYNC_DEBUG
00112 extern mysql_pfs_key_t  sync_thread_mutex_key;
00113 # endif /* UNIV_SYNC_DEBUG */
00114 extern mysql_pfs_key_t  trx_doublewrite_mutex_key;
00115 extern mysql_pfs_key_t  thr_local_mutex_key;
00116 extern mysql_pfs_key_t  trx_undo_mutex_key;
00117 #endif /* UNIV_PFS_MUTEX */
00118 
00119 /******************************************************************/
00121 UNIV_INTERN
00122 void
00123 sync_init(void);
00124 /*===========*/
00125 /******************************************************************/
00127 UNIV_INTERN
00128 void
00129 sync_close(void);
00130 /*===========*/
00131 
00132 #undef mutex_free     /* Fix for MacOS X */
00133 
00134 #ifdef UNIV_PFS_MUTEX
00135 /**********************************************************************
00136 Following mutex APIs would be performance schema instrumented
00137 if "UNIV_PFS_MUTEX" is defined:
00138 
00139 mutex_create
00140 mutex_enter
00141 mutex_exit
00142 mutex_enter_nowait
00143 mutex_free
00144 
00145 These mutex APIs will point to corresponding wrapper functions that contain
00146 the performance schema instrumentation if "UNIV_PFS_MUTEX" is defined.
00147 The instrumented wrapper functions have the prefix of "innodb_".
00148 
00149 NOTE! The following macro should be used in mutex operation, not the
00150 corresponding function. */
00151 
00152 /******************************************************************/
00157 # ifdef UNIV_DEBUG
00158 #  ifdef UNIV_SYNC_DEBUG
00159 #   define mutex_create(K, M, level)        \
00160   pfs_mutex_create_func((K), (M), #M, (level), __FILE__, __LINE__)
00161 #  else
00162 #   define mutex_create(K, M, level)        \
00163   pfs_mutex_create_func((K), (M), #M, __FILE__, __LINE__)
00164 #  endif/* UNIV_SYNC_DEBUG */
00165 # else
00166 #  define mutex_create(K, M, level)       \
00167   pfs_mutex_create_func((K), (M), __FILE__, __LINE__)
00168 # endif /* UNIV_DEBUG */
00169 
00170 # define mutex_enter(M)           \
00171   pfs_mutex_enter_func((M), __FILE__, __LINE__)
00172 
00173 # define mutex_enter_nowait(M)          \
00174   pfs_mutex_enter_nowait_func((M), __FILE__, __LINE__)
00175 
00176 # define mutex_exit(M)  pfs_mutex_exit_func(M)
00177 
00178 # define mutex_free(M)  pfs_mutex_free_func(M)
00179 
00180 #else /* UNIV_PFS_MUTEX */
00181 
00182 /* If "UNIV_PFS_MUTEX" is not defined, the mutex APIs point to
00183 original non-instrumented functions */
00184 # ifdef UNIV_DEBUG
00185 #  ifdef UNIV_SYNC_DEBUG
00186 #   define mutex_create(K, M, level)      \
00187   mutex_create_func((M), #M, (level), __FILE__, __LINE__)
00188 #  else /* UNIV_SYNC_DEBUG */
00189 #   define mutex_create(K, M, level)        \
00190   mutex_create_func((M), #M, __FILE__, __LINE__)
00191 #  endif /* UNIV_SYNC_DEBUG */
00192 # else /* UNIV_DEBUG */
00193 #  define mutex_create(K, M, level)       \
00194   mutex_create_func((M), __FILE__, __LINE__)
00195 # endif /* UNIV_DEBUG */
00196 
00197 # define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
00198 
00199 # define mutex_enter_nowait(M)  \
00200   mutex_enter_nowait_func((M), __FILE__, __LINE__)
00201 
00202 # define mutex_exit(M)  mutex_exit_func(M)
00203 
00204 # define mutex_free(M)  mutex_free_func(M)
00205 
00206 #endif  /* UNIV_PFS_MUTEX */
00207 
00208 /******************************************************************/
00213 UNIV_INTERN
00214 void
00215 mutex_create_func(
00216 /*==============*/
00217   mutex_t*  mutex,    
00218 #ifdef UNIV_DEBUG
00219   const char* cmutex_name,  
00220 # ifdef UNIV_SYNC_DEBUG
00221   ulint   level,    
00222 # endif /* UNIV_SYNC_DEBUG */
00223 #endif /* UNIV_DEBUG */
00224   const char* cfile_name, 
00225   ulint   cline);   
00227 /******************************************************************/
00232 UNIV_INTERN
00233 void
00234 mutex_free_func(
00235 /*============*/
00236   mutex_t*  mutex); 
00237 /**************************************************************/
00241 /* NOTE! currently same as mutex_enter! */
00242 
00243 #define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
00244 /******************************************************************/
00249 UNIV_INLINE
00250 void
00251 mutex_enter_func(
00252 /*=============*/
00253   mutex_t*  mutex,    
00254   const char* file_name,  
00255   ulint   line);    
00256 /********************************************************************/
00261 UNIV_INTERN
00262 ulint
00263 mutex_enter_nowait_func(
00264 /*====================*/
00265   mutex_t*  mutex,    
00266   const char* file_name,  
00268   ulint   line);    
00269 /******************************************************************/
00272 UNIV_INLINE
00273 void
00274 mutex_exit_func(
00275 /*============*/
00276   mutex_t*  mutex); 
00279 #ifdef UNIV_PFS_MUTEX
00280 /******************************************************************/
00286 UNIV_INLINE
00287 void
00288 pfs_mutex_create_func(
00289 /*==================*/
00290   PSI_mutex_key key,    
00291   mutex_t*  mutex,    
00292 # ifdef UNIV_DEBUG
00293   const char* cmutex_name,  
00294 #  ifdef UNIV_SYNC_DEBUG
00295   ulint   level,    
00296 #  endif /* UNIV_SYNC_DEBUG */
00297 # endif /* UNIV_DEBUG */
00298   const char* cfile_name, 
00299   ulint   cline);   
00300 /******************************************************************/
00305 UNIV_INLINE
00306 void
00307 pfs_mutex_enter_func(
00308 /*=================*/
00309   mutex_t*  mutex,    
00310   const char* file_name,  
00311   ulint   line);    
00312 /********************************************************************/
00318 UNIV_INLINE
00319 ulint
00320 pfs_mutex_enter_nowait_func(
00321 /*========================*/
00322   mutex_t*  mutex,    
00323   const char* file_name,  
00325   ulint   line);    
00326 /******************************************************************/
00331 UNIV_INLINE
00332 void
00333 pfs_mutex_exit_func(
00334 /*================*/
00335   mutex_t*  mutex); 
00337 /******************************************************************/
00342 UNIV_INLINE
00343 void
00344 pfs_mutex_free_func(
00345 /*================*/
00346   mutex_t*  mutex); 
00348 #endif /* UNIV_PFS_MUTEX */
00349 
00350 #ifdef UNIV_SYNC_DEBUG
00351 /******************************************************************/
00355 UNIV_INTERN
00356 ibool
00357 sync_all_freed(void);
00358 /*================*/
00359 #endif /* UNIV_SYNC_DEBUG */
00360 /*#####################################################################
00361 FUNCTION PROTOTYPES FOR DEBUGGING */
00362 /*******************************************************************/
00364 UNIV_INTERN
00365 void
00366 sync_print_wait_info(
00367 /*=================*/
00368   FILE* file);    
00369 /*******************************************************************/
00371 UNIV_INTERN
00372 void
00373 sync_print(
00374 /*=======*/
00375   FILE* file);    
00376 #ifdef UNIV_DEBUG
00377 /******************************************************************/
00380 UNIV_INTERN
00381 ibool
00382 mutex_validate(
00383 /*===========*/
00384   const mutex_t*  mutex); 
00385 /******************************************************************/
00389 UNIV_INTERN
00390 ibool
00391 mutex_own(
00392 /*======*/
00393   const mutex_t*  mutex)  
00394   __attribute__((warn_unused_result));
00395 #endif /* UNIV_DEBUG */
00396 #ifdef UNIV_SYNC_DEBUG
00397 /******************************************************************/
00401 UNIV_INTERN
00402 void
00403 sync_thread_add_level(
00404 /*==================*/
00405   void* latch,  
00406   ulint level); 
00408 /******************************************************************/
00413 UNIV_INTERN
00414 ibool
00415 sync_thread_reset_level(
00416 /*====================*/
00417   void* latch); 
00418 /******************************************************************/
00421 UNIV_INTERN
00422 ibool
00423 sync_thread_levels_empty(void);
00424 /*==========================*/
00425 /******************************************************************/
00429 UNIV_INTERN
00430 void*
00431 sync_thread_levels_contains(
00432 /*========================*/
00433   ulint level);     
00435 /******************************************************************/
00438 UNIV_INTERN
00439 void*
00440 sync_thread_levels_nonempty_gen(
00441 /*============================*/
00442   ibool dict_mutex_allowed);  
00446 #define sync_thread_levels_empty_gen(d) (!sync_thread_levels_nonempty_gen(d))
00447 /******************************************************************/
00449 UNIV_INTERN
00450 void
00451 mutex_get_debug_info(
00452 /*=================*/
00453   mutex_t*  mutex,    
00454   const char**  file_name,  
00455   ulint*    line,   
00456   os_thread_id_t* thread_id); 
00458 /******************************************************************/
00461 UNIV_INTERN
00462 ulint
00463 mutex_n_reserved(void);
00464 /*==================*/
00465 #endif /* UNIV_SYNC_DEBUG */
00466 /******************************************************************/
00469 UNIV_INLINE
00470 lock_word_t
00471 mutex_get_lock_word(
00472 /*================*/
00473   const mutex_t*  mutex); 
00474 #ifdef UNIV_SYNC_DEBUG
00475 /******************************************************************/
00479 UNIV_INLINE
00480 ulint
00481 mutex_get_waiters(
00482 /*==============*/
00483   const mutex_t*  mutex); 
00484 #endif /* UNIV_SYNC_DEBUG */
00485 
00486 /*
00487     LATCHING ORDER WITHIN THE DATABASE
00488     ==================================
00489 
00490 The mutex or latch in the central memory object, for instance, a rollback
00491 segment object, must be acquired before acquiring the latch or latches to
00492 the corresponding file data structure. In the latching order below, these
00493 file page object latches are placed immediately below the corresponding
00494 central memory object latch or mutex.
00495 
00496 Synchronization object      Notes
00497 ----------------------      -----
00498 
00499 Dictionary mutex      If we have a pointer to a dictionary
00500 |         object, e.g., a table, it can be
00501 |         accessed without reserving the
00502 |         dictionary mutex. We must have a
00503 |         reservation, a memoryfix, to the
00504 |         appropriate table object in this case,
00505 |         and the table must be explicitly
00506 |         released later.
00507 V
00508 Dictionary header
00509 |
00510 V
00511 Secondary index tree latch    The tree latch protects also all
00512 |         the B-tree non-leaf pages. These
00513 V         can be read with the page only
00514 Secondary index non-leaf    bufferfixed to save CPU time,
00515 |         no s-latch is needed on the page.
00516 |         Modification of a page requires an
00517 |         x-latch on the page, however. If a
00518 |         thread owns an x-latch to the tree,
00519 |         it is allowed to latch non-leaf pages
00520 |         even after it has acquired the fsp
00521 |         latch.
00522 V
00523 Secondary index leaf      The latch on the secondary index leaf
00524 |         can be kept while accessing the
00525 |         clustered index, to save CPU time.
00526 V
00527 Clustered index tree latch    To increase concurrency, the tree
00528 |         latch is usually released when the
00529 |         leaf page latch has been acquired.
00530 V
00531 Clustered index non-leaf
00532 |
00533 V
00534 Clustered index leaf
00535 |
00536 V
00537 Transaction system header
00538 |
00539 V
00540 Transaction undo mutex      The undo log entry must be written
00541 |         before any index page is modified.
00542 |         Transaction undo mutex is for the undo
00543 |         logs the analogue of the tree latch
00544 |         for a B-tree. If a thread has the
00545 |         trx undo mutex reserved, it is allowed
00546 |         to latch the undo log pages in any
00547 |         order, and also after it has acquired
00548 |         the fsp latch.
00549 V
00550 Rollback segment mutex      The rollback segment mutex must be
00551 |         reserved, if, e.g., a new page must
00552 |         be added to an undo log. The rollback
00553 |         segment and the undo logs in its
00554 |         history list can be seen as an
00555 |         analogue of a B-tree, and the latches
00556 |         reserved similarly, using a version of
00557 |         lock-coupling. If an undo log must be
00558 |         extended by a page when inserting an
00559 |         undo log record, this corresponds to
00560 |         a pessimistic insert in a B-tree.
00561 V
00562 Rollback segment header
00563 |
00564 V
00565 Purge system latch
00566 |
00567 V
00568 Undo log pages        If a thread owns the trx undo mutex,
00569 |         or for a log in the history list, the
00570 |         rseg mutex, it is allowed to latch
00571 |         undo log pages in any order, and even
00572 |         after it has acquired the fsp latch.
00573 |         If a thread does not have the
00574 |         appropriate mutex, it is allowed to
00575 |         latch only a single undo log page in
00576 |         a mini-transaction.
00577 V
00578 File space management latch   If a mini-transaction must allocate
00579 |         several file pages, it can do that,
00580 |         because it keeps the x-latch to the
00581 |         file space management in its memo.
00582 V
00583 File system pages
00584 |
00585 V
00586 Kernel mutex        If a kernel operation needs a file
00587 |         page allocation, it must reserve the
00588 |         fsp x-latch before acquiring the kernel
00589 |         mutex.
00590 V
00591 Search system mutex
00592 |
00593 V
00594 Buffer pool mutex
00595 |
00596 V
00597 Log mutex
00598 |
00599 Any other latch
00600 |
00601 V
00602 Memory pool mutex */
00603 
00604 /* Latching order levels */
00605 
00606 /* User transaction locks are higher than any of the latch levels below:
00607 no latches are allowed when a thread goes to wait for a normal table
00608 or row lock! */
00609 #define SYNC_USER_TRX_LOCK  9999
00610 #define SYNC_NO_ORDER_CHECK 3000  /* this can be used to suppress
00611           latching order checking */
00612 #define SYNC_LEVEL_VARYING  2000  /* Level is varying. Only used with
00613           buffer pool page locks, which do not
00614           have a fixed level, but instead have
00615           their level set after the page is
00616           locked; see e.g.
00617           ibuf_bitmap_get_map_page(). */
00618 #define SYNC_TRX_I_S_RWLOCK 1910  /* Used for
00619           trx_i_s_cache_t::rw_lock */
00620 #define SYNC_TRX_I_S_LAST_READ  1900  /* Used for
00621           trx_i_s_cache_t::last_read_mutex */
00622 #define SYNC_FILE_FORMAT_TAG  1200  /* Used to serialize access to the
00623           file format tag */
00624 #define SYNC_DICT_OPERATION 1001  /* table create, drop, etc. reserve
00625           this in X-mode; implicit or backround
00626           operations purge, rollback, foreign
00627           key checks reserve this in S-mode */
00628 #define SYNC_DICT   1000
00629 #define SYNC_DICT_AUTOINC_MUTEX 999
00630 #define SYNC_DICT_HEADER  995
00631 #define SYNC_IBUF_HEADER  914
00632 #define SYNC_IBUF_PESS_INSERT_MUTEX 912
00633 #define SYNC_IBUF_MUTEX   910 /* ibuf mutex is really below
00634           SYNC_FSP_PAGE: we assign a value this
00635           high only to make the program to pass
00636           the debug checks */
00637 /*-------------------------------*/
00638 #define SYNC_INDEX_TREE   900
00639 #define SYNC_TREE_NODE_NEW  892
00640 #define SYNC_TREE_NODE_FROM_HASH 891
00641 #define SYNC_TREE_NODE    890
00642 #define SYNC_PURGE_SYS    810
00643 #define SYNC_PURGE_LATCH  800
00644 #define SYNC_TRX_UNDO   700
00645 #define SYNC_RSEG   600
00646 #define SYNC_RSEG_HEADER_NEW  591
00647 #define SYNC_RSEG_HEADER  590
00648 #define SYNC_TRX_UNDO_PAGE  570
00649 #define SYNC_EXTERN_STORAGE 500
00650 #define SYNC_FSP    400
00651 #define SYNC_FSP_PAGE   395
00652 /*------------------------------------- Insert buffer headers */
00653 /*------------------------------------- ibuf_mutex */
00654 /*------------------------------------- Insert buffer tree */
00655 #define SYNC_IBUF_BITMAP_MUTEX  351
00656 #define SYNC_IBUF_BITMAP  350
00657 /*------------------------------------- MySQL query cache mutex */
00658 /*------------------------------------- MySQL binlog mutex */
00659 /*-------------------------------*/
00660 #define SYNC_KERNEL   300
00661 #define SYNC_REC_LOCK   299
00662 #define SYNC_TRX_LOCK_HEAP  298
00663 #define SYNC_TRX_SYS_HEADER 290
00664 #define SYNC_LOG    170
00665 #define SYNC_LOG_FLUSH_ORDER  147
00666 #define SYNC_RECV   168
00667 #define SYNC_WORK_QUEUE   162
00668 #define SYNC_SEARCH_SYS_CONF  161 /* for assigning btr_search_enabled */
00669 #define SYNC_SEARCH_SYS   160 /* NOTE that if we have a memory
00670           heap that can be extended to the
00671           buffer pool, its logical level is
00672           SYNC_SEARCH_SYS, as memory allocation
00673           can call routines there! Otherwise
00674           the level is SYNC_MEM_HASH. */
00675 #define SYNC_COMMIT_ID_LOCK 159     
00676 #define SYNC_BUF_POOL   150 /* Buffer pool mutex */
00677 #define SYNC_BUF_BLOCK    146 /* Block mutex */
00678 #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */
00679 #define SYNC_DOUBLEWRITE  140
00680 #define SYNC_ANY_LATCH    135
00681 #define SYNC_THR_LOCAL    133
00682 #define SYNC_MEM_HASH   131
00683 #define SYNC_MEM_POOL   130
00684 
00685 /* Codes used to designate lock operations */
00686 #define RW_LOCK_NOT_LOCKED  350
00687 #define RW_LOCK_EX    351
00688 #define RW_LOCK_EXCLUSIVE 351
00689 #define RW_LOCK_SHARED    352
00690 #define RW_LOCK_WAIT_EX   353
00691 #define SYNC_MUTEX    354
00692 
00693 /* NOTE! The structure appears here only for the compiler to know its size.
00694 Do not use its fields directly! The structure used in the spin lock
00695 implementation of a mutual exclusion semaphore. */
00696 
00698 struct mutex_struct {
00699   os_event_t  event;  
00700   volatile lock_word_t  lock_word;  
00704 #if !defined(HAVE_ATOMIC_BUILTINS)
00705   os_fast_mutex_t
00706     os_fast_mutex;  
00708 #endif
00709   ulint waiters;  
00713   UT_LIST_NODE_T(mutex_t) list; 
00715 #ifdef UNIV_SYNC_DEBUG
00716   const char* file_name;  
00717   ulint line;   
00718   ulint level;    
00719 #endif /* UNIV_SYNC_DEBUG */
00720   const char* cfile_name;
00721   ulint   cline;  
00722 #ifdef UNIV_DEBUG
00723   os_thread_id_t thread_id; 
00725   ulint   magic_n;  
00727 # define MUTEX_MAGIC_N  (ulint)979585
00728 #endif /* UNIV_DEBUG */
00729   ulong   count_os_wait;  
00730 #ifdef UNIV_DEBUG
00731   ulong   count_using;  
00732   ulong   count_spin_loop; 
00733   ulong   count_spin_rounds;
00734   ulong   count_os_yield; 
00735   ulonglong lspent_time;  
00736   ulonglong lmax_spent_time;
00737   const char* cmutex_name;  
00738   ulint   mutex_type; 
00739 #endif /* UNIV_DEBUG */
00740 #ifdef UNIV_PFS_MUTEX
00741   struct PSI_mutex* pfs_psi;  
00743 #endif
00744 };
00745 
00748 extern sync_array_t*  sync_primary_wait_array;/* Appears here for
00749             debugging purposes only! */
00750 
00755 #define SYNC_SPIN_ROUNDS  srv_n_spin_wait_rounds
00756 
00758 extern  ib_int64_t  mutex_exit_count;
00759 
00760 #ifdef UNIV_SYNC_DEBUG
00761 
00762 extern ibool  sync_order_checks_on;
00763 #endif /* UNIV_SYNC_DEBUG */
00764 
00766 extern ibool  sync_initialized;
00767 
00769 typedef UT_LIST_BASE_NODE_T(mutex_t)  ut_list_base_node_t;
00771 extern ut_list_base_node_t  mutex_list;
00772 
00774 extern mutex_t mutex_list_mutex;
00775 
00776 
00777 #ifndef UNIV_NONINL
00778 #include "sync0sync.ic"
00779 #endif
00780 
00781 #endif