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
This commit is contained in:
parent
f3e578ab30
commit
517ef2bd39
@ -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));
|
||||
/* Take thread from queue. */
|
||||
next= thread->next;
|
||||
thread->next= NULL;
|
||||
|
||||
/* Signal the thread. */
|
||||
keycache_pthread_cond_signal(&thread->suspend);
|
||||
/* Take thread from queue. */
|
||||
next=thread->next;
|
||||
thread->next= NULL;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user