D.S

dev.mysql.com

MySQL: include/mysql/psi/mysql_rwlock.h Source File

MySQL: include/mysql/psi/mysql_rwlock.h Source File MySQL  8.0.0 Source Code Documentation Main Page Related Pages Modules Namespaces Classes Files File List File Members mysql_rwlock.h Go to the documentation of this file. 1 /* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. 2  3  This program is free software; you can redistribute it and/or modify 4  it under the terms of the GNU General Public License as published by 5  the Free Software Foundation; version 2 of the License. 6  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  12  You should have received a copy of the GNU General Public License 13  along with this program; if not, write to the Free Software Foundation, 14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 15  16 #ifndef MYSQL_RWLOCK_H 17 #define MYSQL_RWLOCK_H 18  19 /** 20  @file include/mysql/psi/mysql_rwlock.h 21  Instrumentation helpers for rwlock. 22 */ 23  24 #include " thr_rwlock.h " 25 #include " mysql/psi/psi_rwlock.h " 26 #ifdef MYSQL_SERVER 27 #ifndef MYSQL_DYNAMIC_PLUGIN 28 #include " pfs_rwlock_provider.h " 29 #endif 30 #endif 31  32 #ifndef PSI_RWLOCK_CALL 33 #define PSI_RWLOCK_CALL(M) psi_rwlock_service->M 34 #endif 35  36 /** 37  @defgroup psi_api_rwlock Rwlock Instrumentation (API) 38  @ingroup psi_api 39  @{ 40 */ 41  42 /** 43  @def mysql_prlock_assert_write_owner(M) 44  Drop-in replacement 45  for @c rw_pr_lock_assert_write_owner. 46 */ 47 #ifdef SAFE_MUTEX 48 #define mysql_prlock_assert_write_owner(M) \ 49  rw_pr_lock_assert_write_owner(&(M)->m_prlock) 50 #else 51  #define mysql_prlock_assert_write_owner(M) { } 52 #endif 53  54 /** 55  @def mysql_prlock_assert_not_write_owner(M) 56  Drop-in replacement 57  for @c rw_pr_lock_assert_not_write_owner. 58 */ 59 #ifdef SAFE_MUTEX 60 #define mysql_prlock_assert_not_write_owner(M) \ 61  rw_pr_lock_assert_not_write_owner(&(M)->m_prlock) 62 #else 63  #define mysql_prlock_assert_not_write_owner(M) { } 64 #endif 65  66 /** 67  An instrumented rwlock structure. 68  @sa mysql_rwlock_t 69 */ 70  struct st_mysql_rwlock 71 { 72  /** The real rwlock */ 73   native_rw_lock_t m_rwlock ; 74  /** 75  The instrumentation hook. 76  Note that this hook is not conditionally defined, 77  for binary compatibility of the @c mysql_rwlock_t interface. 78  */ 79   struct PSI_rwlock * m_psi ; 80 }; 81  82 /** 83  An instrumented prlock structure. 84  @sa mysql_prlock_t 85 */ 86  struct st_mysql_prlock 87 { 88  /** The real prlock */ 89   rw_pr_lock_t m_prlock ; 90  /** 91  The instrumentation hook. 92  Note that this hook is not conditionally defined, 93  for binary compatibility of the @c mysql_rwlock_t interface. 94  */ 95   struct PSI_rwlock * m_psi ; 96 }; 97  98 /** 99  Type of an instrumented rwlock. 100  @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t. 101  @sa mysql_rwlock_init 102  @sa mysql_rwlock_rdlock 103  @sa mysql_rwlock_tryrdlock 104  @sa mysql_rwlock_wrlock 105  @sa mysql_rwlock_trywrlock 106  @sa mysql_rwlock_unlock 107  @sa mysql_rwlock_destroy 108 */ 109  typedef struct st_mysql_rwlock mysql_rwlock_t ; 110  111 /** 112  Type of an instrumented prlock. 113  A prlock is a read write lock that 'prefers readers' (pr). 114  @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. 115  @sa mysql_prlock_init 116  @sa mysql_prlock_rdlock 117  @sa mysql_prlock_wrlock 118  @sa mysql_prlock_unlock 119  @sa mysql_prlock_destroy 120 */ 121  typedef struct st_mysql_prlock mysql_prlock_t ; 122  123 #ifndef DISABLE_MYSQL_THREAD_H 124  125 /** 126  @def mysql_rwlock_register(P1, P2, P3) 127  Rwlock registration. 128 */ 129  #define mysql_rwlock_register(P1, P2, P3) \ 130  inline_mysql_rwlock_register(P1, P2, P3) 131  132 /** 133  @def mysql_rwlock_init(K, RW) 134  Instrumented rwlock_init. 135  @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init. 136  Note that pthread_rwlockattr_t is not supported in MySQL. 137  @param K The PSI_rwlock_key for this instrumented rwlock 138  @param RW The rwlock to initialize 139 */ 140 #ifdef HAVE_PSI_RWLOCK_INTERFACE 141   #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW) 142 #else 143  #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW) 144 #endif 145  146 /** 147  @def mysql_prlock_init(K, RW) 148  Instrumented rw_pr_init. 149  @c mysql_prlock_init is a replacement for @c rw_pr_init. 150  @param K The PSI_rwlock_key for this instrumented prlock 151  @param RW The prlock to initialize 152 */ 153 #ifdef HAVE_PSI_RWLOCK_INTERFACE 154   #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW) 155 #else 156  #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW) 157 #endif 158  159 /** 160  @def mysql_rwlock_destroy(RW) 161  Instrumented rwlock_destroy. 162  @c mysql_rwlock_destroy is a drop-in replace