mirror of
https://github.com/MariaDB/server.git
synced 2026-05-03 13:45:34 +02:00
Add InnoDB UNIV_SYNC_DEBUG assertions to rw-lock code.
rw_lock_x_lock_func(): Assert that the thread is not already holding the lock in a conflicting mode (RW_LOCK_SHARED). rw_lock_s_lock_func(): Assert that the thread is not already holding the lock in a conflicting mode (RW_LOCK_EX).
This commit is contained in:
parent
96c2c18e4f
commit
16c919527f
4 changed files with 8 additions and 0 deletions
|
|
@ -238,6 +238,7 @@ rw_lock_s_lock_func(
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
mutex_enter(rw_lock_get_mutex(lock));
|
||||
|
|
|
|||
|
|
@ -476,6 +476,9 @@ rw_lock_x_lock_func(
|
|||
ulint i; /* spin round count */
|
||||
|
||||
ut_ad(rw_lock_validate(lock));
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
lock_loop:
|
||||
/* Acquire the mutex protecting the rw-lock fields */
|
||||
|
|
|
|||
|
|
@ -406,6 +406,7 @@ rw_lock_s_lock_func(
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
/* TODO: study performance of UNIV_LIKELY branch prediction hints. */
|
||||
|
|
|
|||
|
|
@ -612,6 +612,9 @@ rw_lock_x_lock_func(
|
|||
ibool spinning = FALSE;
|
||||
|
||||
ut_ad(rw_lock_validate(lock));
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
i = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue