Commit 44676ed5 authored by Monty's avatar Monty Committed by Sergei Golubchik

Cleaned up output from thr_print_locks

parent 4040a17e
......@@ -1684,31 +1684,35 @@ void thr_print_locks(void)
uint count=0;
mysql_mutex_lock(&THR_LOCK_lock);
puts("Current locks:");
puts("Current active THR (table level locks):");
for (list= thr_lock_thread_list; list && count++ < MAX_THREADS;
list= list_rest(list))
{
THR_LOCK *lock=(THR_LOCK*) list->data;
mysql_mutex_lock(&lock->mutex);
printf("lock: 0x%lx:",(ulong) lock);
if ((lock->write_wait.data || lock->read_wait.data) &&
(! lock->read.data && ! lock->write.data))
printf(" WARNING: ");
if (lock->write.data)
printf(" write");
if (lock->write_wait.data)
printf(" write_wait");
if (lock->read.data)
printf(" read");
if (lock->read_wait.data)
printf(" read_wait");
puts("");
thr_print_lock("write",&lock->write);
thr_print_lock("write_wait",&lock->write_wait);
thr_print_lock("read",&lock->read);
thr_print_lock("read_wait",&lock->read_wait);
if ((lock->write.data || lock->read.data ||
lock->write_wait.data || lock->read_wait.data))
{
printf("lock: 0x%lx:",(ulong) lock);
if ((lock->write_wait.data || lock->read_wait.data) &&
(! lock->read.data && ! lock->write.data))
printf(" WARNING: ");
if (lock->write.data)
printf(" write");
if (lock->write_wait.data)
printf(" write_wait");
if (lock->read.data)
printf(" read");
if (lock->read_wait.data)
printf(" read_wait");
puts("");
thr_print_lock("write",&lock->write);
thr_print_lock("write_wait",&lock->write_wait);
thr_print_lock("read",&lock->read);
thr_print_lock("read_wait",&lock->read_wait);
puts("");
}
mysql_mutex_unlock(&lock->mutex);
puts("");
}
fflush(stdout);
mysql_mutex_unlock(&THR_LOCK_lock);
......
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