mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
Add ut_ad() debug assertions.
UT_LIST_ADD_FIRST(), UT_LIST_ADD_LAST(), UT_LIST_INSERT_AFTER(): Assert against some trivial cases of cyclic lists. mutex_enter_func(): Assert that the current thread is not holding the mutex.
This commit is contained in:
parent
4c643e0e1a
commit
1750a977ac
2 changed files with 4 additions and 0 deletions
|
@ -250,6 +250,7 @@ mutex_enter_func(
|
||||||
ulint line) /* in: line where locked */
|
ulint line) /* in: line where locked */
|
||||||
{
|
{
|
||||||
ut_ad(mutex_validate(mutex));
|
ut_ad(mutex_validate(mutex));
|
||||||
|
ut_ad(!mutex_own(mutex));
|
||||||
|
|
||||||
/* Note that we do not peek at the value of lock_word before trying
|
/* Note that we do not peek at the value of lock_word before trying
|
||||||
the atomic test_and_set; we could peek, and possibly save time. */
|
the atomic test_and_set; we could peek, and possibly save time. */
|
||||||
|
|
|
@ -74,6 +74,7 @@ the pointer to the node to be added to the list. NAME is the list name. */
|
||||||
((N)->NAME).next = (BASE).start;\
|
((N)->NAME).next = (BASE).start;\
|
||||||
((N)->NAME).prev = NULL;\
|
((N)->NAME).prev = NULL;\
|
||||||
if ((BASE).start != NULL) {\
|
if ((BASE).start != NULL) {\
|
||||||
|
ut_ad((BASE).start != (N));\
|
||||||
(((BASE).start)->NAME).prev = (N);\
|
(((BASE).start)->NAME).prev = (N);\
|
||||||
}\
|
}\
|
||||||
(BASE).start = (N);\
|
(BASE).start = (N);\
|
||||||
|
@ -94,6 +95,7 @@ the pointer to the node to be added to the list. NAME is the list name. */
|
||||||
((N)->NAME).prev = (BASE).end;\
|
((N)->NAME).prev = (BASE).end;\
|
||||||
((N)->NAME).next = NULL;\
|
((N)->NAME).next = NULL;\
|
||||||
if ((BASE).end != NULL) {\
|
if ((BASE).end != NULL) {\
|
||||||
|
ut_ad((BASE).end != (N));\
|
||||||
(((BASE).end)->NAME).next = (N);\
|
(((BASE).end)->NAME).next = (N);\
|
||||||
}\
|
}\
|
||||||
(BASE).end = (N);\
|
(BASE).end = (N);\
|
||||||
|
@ -111,6 +113,7 @@ name, NODE1 and NODE2 are pointers to nodes. */
|
||||||
{\
|
{\
|
||||||
ut_ad(NODE1);\
|
ut_ad(NODE1);\
|
||||||
ut_ad(NODE2);\
|
ut_ad(NODE2);\
|
||||||
|
ut_ad((NODE1) != (NODE2));\
|
||||||
((BASE).count)++;\
|
((BASE).count)++;\
|
||||||
((NODE2)->NAME).prev = (NODE1);\
|
((NODE2)->NAME).prev = (NODE1);\
|
||||||
((NODE2)->NAME).next = ((NODE1)->NAME).next;\
|
((NODE2)->NAME).next = ((NODE1)->NAME).next;\
|
||||||
|
|
Loading…
Reference in a new issue