Commit 1750a977 authored by marko's avatar marko

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.
parent 4c643e0e
...@@ -250,6 +250,7 @@ mutex_enter_func( ...@@ -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. */ ...@@ -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. */ ...@@ -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. */ ...@@ -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;\
......
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