Commit 16c91952 authored by Marko Mäkelä's avatar Marko Mäkelä

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).
parent 96c2c18e
...@@ -238,6 +238,7 @@ rw_lock_s_lock_func( ...@@ -238,6 +238,7 @@ rw_lock_s_lock_func(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */ 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 */ #endif /* UNIV_SYNC_DEBUG */
mutex_enter(rw_lock_get_mutex(lock)); mutex_enter(rw_lock_get_mutex(lock));
......
...@@ -476,6 +476,9 @@ rw_lock_x_lock_func( ...@@ -476,6 +476,9 @@ rw_lock_x_lock_func(
ulint i; /* spin round count */ ulint i; /* spin round count */
ut_ad(rw_lock_validate(lock)); 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: lock_loop:
/* Acquire the mutex protecting the rw-lock fields */ /* Acquire the mutex protecting the rw-lock fields */
......
...@@ -406,6 +406,7 @@ rw_lock_s_lock_func( ...@@ -406,6 +406,7 @@ rw_lock_s_lock_func(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */ 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 */ #endif /* UNIV_SYNC_DEBUG */
/* TODO: study performance of UNIV_LIKELY branch prediction hints. */ /* TODO: study performance of UNIV_LIKELY branch prediction hints. */
......
...@@ -612,6 +612,9 @@ rw_lock_x_lock_func( ...@@ -612,6 +612,9 @@ rw_lock_x_lock_func(
ibool spinning = FALSE; ibool spinning = FALSE;
ut_ad(rw_lock_validate(lock)); 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; i = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment