Commit 517ef2bd authored by Monty's avatar Monty

Added easy way to assert if another thread has died.

Added some extra safety asserts in MyISAM key cache.

my_thread_var->init is now:
0 at startup
1 at init
2 when thread dies
parent f3e578ab
......@@ -1123,6 +1123,7 @@ static void wait_on_queue(KEYCACHE_WQUEUE *wqueue,
struct st_my_thread_var *thread= my_thread_var;
DBUG_ASSERT(!thread->next);
DBUG_ASSERT(!thread->prev); /* Not required, but must be true anyway. */
mysql_mutex_assert_owner(mutex);
/* Add to queue. */
if (! (last= wqueue->last_thread))
......@@ -1177,14 +1178,15 @@ static void release_whole_queue(KEYCACHE_WQUEUE *wqueue)
do
{
thread=next;
DBUG_ASSERT(thread);
DBUG_ASSERT(thread && thread->init == 1);
KEYCACHE_DBUG_PRINT("release_whole_queue: signal",
("thread %ld", thread->id));
/* Signal the thread. */
keycache_pthread_cond_signal(&thread->suspend);
/* Take thread from queue. */
next=thread->next;
next= thread->next;
thread->next= NULL;
/* Signal the thread. */
keycache_pthread_cond_signal(&thread->suspend);
}
while (thread != last);
......
......@@ -372,6 +372,8 @@ void my_thread_end(void)
mysql_cond_signal(&THR_COND_threads);
mysql_mutex_unlock(&THR_LOCK_threads);
/* Trash variable so that we can detect false accesses to my_thread_var */
tmp->init= 2;
TRASH(tmp, sizeof(*tmp));
free(tmp);
}
......
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