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;
683
/* Record the entry of rw x lock request in performance schema */
684
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
685
locker = PSI_server->get_thread_rwlock_locker(
686
lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
689
PSI_server->start_rwlock_wrwait(locker,
694
rw_lock_x_lock_func(lock, pass, file_name, line);
697
PSI_server->end_rwlock_wrwait(locker, 0);
700
/******************************************************************//**
701
Performance schema instrumented wrap function for
702
rw_lock_x_lock_func_nowait()
703
NOTE! Please use the corresponding macro rw_lock_x_lock_func(),
704
not directly this function!
705
@return TRUE if success */
708
pfs_rw_lock_x_lock_func_nowait(
709
/*===========================*/
710
rw_lock_t* lock, /*!< in: pointer to rw-lock */
711
const char* file_name,/*!< in: file name where lock
713
ulint line) /*!< in: line where requested */
715
struct PSI_rwlock_locker* locker = NULL;
718
/* Record the entry of rw x lock request in performance schema */
719
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
720
locker = PSI_server->get_thread_rwlock_locker(
721
lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
724
PSI_server->start_rwlock_wrwait(locker,
729
ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
732
PSI_server->end_rwlock_wrwait(locker, 0);
737
/******************************************************************//**
738
Performance schema instrumented wrap function for rw_lock_free_func()
739
NOTE! Please use the corresponding macro rw_lock_free(), not directly
743
pfs_rw_lock_free_func(
744
/*==================*/
745
rw_lock_t* lock) /*!< in: pointer to rw-lock */
747
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
748
PSI_server->destroy_rwlock(lock->pfs_psi);
749
lock->pfs_psi = NULL;
752
rw_lock_free_func(lock);
754
/******************************************************************//**
755
Performance schema instrumented wrap function for rw_lock_s_lock_func()
756
NOTE! Please use the corresponding macro rw_lock_s_lock(), not
757
directly this function! */
760
pfs_rw_lock_s_lock_func(
761
/*====================*/
762
rw_lock_t* lock, /*!< in: pointer to rw-lock */
763
ulint pass, /*!< in: pass value; != 0, if the
764
lock will be passed to another
766
const char* file_name,/*!< in: file name where lock
768
ulint line) /*!< in: line where requested */
770
struct PSI_rwlock_locker* locker = NULL;
772
/* Instrumented to inform we are aquiring a shared rwlock */
773
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
774
locker = PSI_server->get_thread_rwlock_locker(
775
lock->pfs_psi, PSI_RWLOCK_READLOCK);
777
PSI_server->start_rwlock_rdwait(locker,
782
rw_lock_s_lock_func(lock, pass, file_name, line);
785
PSI_server->end_rwlock_rdwait(locker, 0);
788
/******************************************************************//**
789
Performance schema instrumented wrap function for rw_lock_s_lock_func()
790
NOTE! Please use the corresponding macro rw_lock_s_lock(), not
791
directly this function!
792
@return TRUE if success */
795
pfs_rw_lock_s_lock_low(
796
/*===================*/
797
rw_lock_t* lock, /*!< in: pointer to rw-lock */
798
ulint pass, /*!< in: pass value; != 0, if the
799
lock will be passed to another
801
const char* file_name, /*!< in: file name where lock requested */
802
ulint line) /*!< in: line where requested */
805
struct PSI_rwlock_locker* locker = NULL;
808
/* Instrumented to inform we are aquiring a shared rwlock */
809
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
810
locker = PSI_server->get_thread_rwlock_locker(
811
lock->pfs_psi, PSI_RWLOCK_READLOCK);
813
PSI_server->start_rwlock_rdwait(locker,
818
ret = rw_lock_s_lock_low(lock, pass, file_name, line);
821
PSI_server->end_rwlock_rdwait(locker, 0);
827
/******************************************************************//**
828
Performance schema instrumented wrap function for rw_lock_x_unlock_func()
829
NOTE! Please use the corresponding macro rw_lock_x_unlock(), not directly
833
pfs_rw_lock_x_unlock_func(
834
/*======================*/
835
#ifdef UNIV_SYNC_DEBUG
836
ulint pass, /*!< in: pass value; != 0, if the
837
lock may have been passed to another
840
rw_lock_t* lock) /*!< in/out: rw-lock */
842
/* Inform performance schema we are unlocking the lock */
843
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
844
struct PSI_thread* thread;
845
thread = PSI_server->get_thread();
847
PSI_server->unlock_rwlock(thread, lock->pfs_psi);
851
rw_lock_x_unlock_func(
852
#ifdef UNIV_SYNC_DEBUG
858
/******************************************************************//**
859
Performance schema instrumented wrap function for rw_lock_s_unlock_func()
860
NOTE! Please use the corresponding macro pfs_rw_lock_s_unlock(), not
861
directly this function! */
864
pfs_rw_lock_s_unlock_func(
865
/*======================*/
866
#ifdef UNIV_SYNC_DEBUG
867
ulint pass, /*!< in: pass value; != 0, if the
868
lock may have been passed to another
871
rw_lock_t* lock) /*!< in/out: rw-lock */
873
/* Inform performance schema we are unlocking the lock */
874
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
875
struct PSI_thread* thread;
876
thread = PSI_server->get_thread();
878
PSI_server->unlock_rwlock(thread, lock->pfs_psi);
882
rw_lock_s_unlock_func(
883
#ifdef UNIV_SYNC_DEBUG
889
#endif /* UNIV_PFS_RWLOCK */