diff options
| author | tangyuxin <[email protected]> | 2022-10-19 11:37:57 +0800 |
|---|---|---|
| committer | Man, Jianting (Meco) <[email protected]> | 2022-12-06 21:15:13 -0500 |
| commit | a535218ba6dc23e1efeaf2b6bc0dd13ec8c841a4 (patch) | |
| tree | 677ca0c9d56b44a6fa86f11432bfcc6e1c88fc59 | |
| parent | 197ce2cd40cb17151dcd404e78712881f63795f5 (diff) | |
[shell]list_mutex show suspended Threads
| -rw-r--r-- | components/finsh/cmd.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index f03a78f38e..2ba98a1a22 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -408,9 +408,9 @@ long list_mutex(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s owner hold suspend thread priority\n", maxlen, item_title); + rt_kprintf("%-*.s owner hold priority suspend thread \n", maxlen, item_title); object_split(maxlen); - rt_kprintf(" -------- ---- -------------- --------\n"); + rt_kprintf(" -------- ---- -------- --------------\n"); do { @@ -433,15 +433,30 @@ long list_mutex(void) rt_hw_interrupt_enable(level); m = (struct rt_mutex *)obj; - rt_kprintf("%-*.*s %-8.*s %04d %d %d\n", + if (!rt_list_isempty(&m->parent.suspend_thread)) + { + rt_kprintf("%-*.*s %-8.*s %04d %8d %04d ", maxlen, RT_NAME_MAX, m->parent.parent.name, RT_NAME_MAX, m->owner->name, m->hold, - rt_list_len(&m->parent.suspend_thread), - m->priority); - + m->priority, + rt_list_len(&m->parent.suspend_thread)); + show_wait_queue(&(m->parent.suspend_thread)); + rt_kprintf("\n"); + } + else + { + rt_kprintf("%-*.*s %-8.*s %04d %8d %04d\n", + maxlen, RT_NAME_MAX, + m->parent.parent.name, + RT_NAME_MAX, + m->owner->name, + m->hold, + m->priority, + rt_list_len(&m->parent.suspend_thread)); + } } } } |
