625
625
rw_x_exit_count++;
629
#ifdef UNIV_PFS_RWLOCK
631
/******************************************************************//**
632
Performance schema instrumented wrap function for rw_lock_create_func().
633
NOTE! Please use the corresponding macro rw_lock_create(), not directly
637
pfs_rw_lock_create_func(
638
/*====================*/
639
mysql_pfs_key_t key, /*!< in: key registered with
640
performance schema */
641
rw_lock_t* lock, /*!< in: pointer to memory */
643
# ifdef UNIV_SYNC_DEBUG
644
ulint level, /*!< in: level */
645
# endif /* UNIV_SYNC_DEBUG */
646
const char* cmutex_name, /*!< in: mutex name */
647
# endif /* UNIV_DEBUG */
648
const char* cfile_name, /*!< in: file name where created */
649
ulint cline) /*!< in: file line where created */
651
/* Initialize the rwlock for performance schema */
652
lock->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
653
? PSI_server->init_rwlock(key, lock)
656
/* The actual function to initialize an rwlock */
657
rw_lock_create_func(lock,
659
# ifdef UNIV_SYNC_DEBUG
661
# endif /* UNIV_SYNC_DEBUG */
663
# endif /* UNIV_DEBUG */
667
/******************************************************************//**
668
Performance schema instrumented wrap function for rw_lock_x_lock_func()
669
NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly
673
pfs_rw_lock_x_lock_func(
674
/*====================*/
675
rw_lock_t* lock, /*!< in: pointer to rw-lock */
676
ulint pass, /*!< in: pass value; != 0, if the lock will
677
be passed to another thread to unlock */
678
const char* file_name,/*!< in: file name where lock requested */
679
ulint line) /*!< in: line where requested */
681
struct PSI_rwlock_locker* locker = NULL;
682
PSI_rwlock_locker_state state;
684
/* Record the entry of rw x lock request in performance schema */
685
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
686
locker = PSI_server->get_thread_rwlock_locker(
687
&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
690
PSI_server->start_rwlock_wrwait(locker,
695
rw_lock_x_lock_func(lock, pass, file_name, line);
698
PSI_server->end_rwlock_wrwait(locker, 0);
701
/******************************************************************//**
702
Performance schema instrumented wrap function for
703
rw_lock_x_lock_func_nowait()
704
NOTE! Please use the corresponding macro rw_lock_x_lock_func(),
705
not directly this function!
706
@return TRUE if success */
709
pfs_rw_lock_x_lock_func_nowait(
710
/*===========================*/
711
rw_lock_t* lock, /*!< in: pointer to rw-lock */
712
const char* file_name,/*!< in: file name where lock
714
ulint line) /*!< in: line where requested */
716
struct PSI_rwlock_locker* locker = NULL;
717
PSI_rwlock_locker_state state;
720
/* Record the entry of rw x lock request in performance schema */
721
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
722
locker = PSI_server->get_thread_rwlock_locker(
723
&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
726
PSI_server->start_rwlock_wrwait(locker,
731
ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
734
PSI_server->end_rwlock_wrwait(locker, 0);
739
/******************************************************************//**
740
Performance schema instrumented wrap function for rw_lock_free_func()
741
NOTE! Please use the corresponding macro rw_lock_free(), not directly
745
pfs_rw_lock_free_func(
746
/*==================*/
747
rw_lock_t* lock) /*!< in: pointer to rw-lock */
749
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
750
PSI_server->destroy_rwlock(lock->pfs_psi);
751
lock->pfs_psi = NULL;
754
rw_lock_free_func(lock);
756
/******************************************************************//**
757
Performance schema instrumented wrap function for rw_lock_s_lock_func()
758
NOTE! Please use the corresponding macro rw_lock_s_lock(), not
759
directly this function! */
762
pfs_rw_lock_s_lock_func(
763
/*====================*/
764
rw_lock_t* lock, /*!< in: pointer to rw-lock */
765
ulint pass, /*!< in: pass value; != 0, if the
766
lock will be passed to another
768
const char* file_name,/*!< in: file name where lock
770
ulint line) /*!< in: line where requested */
772
struct PSI_rwlock_locker* locker = NULL;
773
PSI_rwlock_locker_state state;
775
/* Instrumented to inform we are aquiring a shared rwlock */
776
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
777
locker = PSI_server->get_thread_rwlock_locker(
778
&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
780
PSI_server->start_rwlock_rdwait(locker,
785
rw_lock_s_lock_func(lock, pass, file_name, line);
788
PSI_server->end_rwlock_rdwait(locker, 0);
791
/******************************************************************//**
792
Performance schema instrumented wrap function for rw_lock_s_lock_func()
793
NOTE! Please use the corresponding macro rw_lock_s_lock(), not
794
directly this function!
795
@return TRUE if success */
798
pfs_rw_lock_s_lock_low(
799
/*===================*/
800
rw_lock_t* lock, /*!< in: pointer to rw-lock */
801
ulint pass, /*!< in: pass value; != 0, if the
802
lock will be passed to another
804
const char* file_name, /*!< in: file name where lock requested */
805
ulint line) /*!< in: line where requested */
807
struct PSI_rwlock_locker* locker = NULL;
808
PSI_rwlock_locker_state state;
811
/* Instrumented to inform we are aquiring a shared rwlock */
812
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
813
locker = PSI_server->get_thread_rwlock_locker(
814
&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
816
PSI_server->start_rwlock_rdwait(locker,
821
ret = rw_lock_s_lock_low(lock, pass, file_name, line);
824
PSI_server->end_rwlock_rdwait(locker, 0);
830
/******************************************************************//**
831
Performance schema instrumented wrap function for rw_lock_x_unlock_func()
832
NOTE! Please use the corresponding macro rw_lock_x_unlock(), not directly
836
pfs_rw_lock_x_unlock_func(
837
/*======================*/
838
#ifdef UNIV_SYNC_DEBUG
839
ulint pass, /*!< in: pass value; != 0, if the
840
lock may have been passed to another
843
rw_lock_t* lock) /*!< in/out: rw-lock */
845
/* Inform performance schema we are unlocking the lock */
846
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
847
PSI_server->unlock_rwlock(lock->pfs_psi);
850
rw_lock_x_unlock_func(
851
#ifdef UNIV_SYNC_DEBUG
857
/******************************************************************//**
858
Performance schema instrumented wrap function for rw_lock_s_unlock_func()
859
NOTE! Please use the corresponding macro pfs_rw_lock_s_unlock(), not
860
directly this function! */
863
pfs_rw_lock_s_unlock_func(
864
/*======================*/
865
#ifdef UNIV_SYNC_DEBUG
866
ulint pass, /*!< in: pass value; != 0, if the
867
lock may have been passed to another
870
rw_lock_t* lock) /*!< in/out: rw-lock */
872
/* Inform performance schema we are unlocking the lock */
873
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
874
PSI_server->unlock_rwlock(lock->pfs_psi);
877
rw_lock_s_unlock_func(
878
#ifdef UNIV_SYNC_DEBUG
884
#endif /* UNIV_PFS_RWLOCK */