diff options
| author | shaojinchun <[email protected]> | 2019-09-16 16:55:40 +0800 |
|---|---|---|
| committer | shaojinchun <[email protected]> | 2019-09-16 16:55:40 +0800 |
| commit | ae1fdc70f0086c0e12bfe02c9b69153e7743dc22 (patch) | |
| tree | 3ddbd406b7c92219ea8dbec91fd4a708c2c2f28a /components | |
| parent | 91c858ead231bdef64478f59a0fe3b43128be21b (diff) | |
修正rt_mp_free有可能唤醒一个错误任务指针的问题
Diffstat (limited to 'components')
| -rw-r--r-- | components/finsh/cmd.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 680d9d01d7..f8b774bd6f 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -675,6 +675,8 @@ long list_mempool(void) { struct rt_object *obj; struct rt_mempool *mp; + int suspend_thread_count; + rt_list_t *node; obj = rt_list_entry(obj_list[i], struct rt_object, list); level = rt_hw_interrupt_disable(); @@ -687,7 +689,14 @@ long list_mempool(void) rt_hw_interrupt_enable(level); mp = (struct rt_mempool *)obj; - if (mp->suspend_thread_count > 0) + + suspend_thread_count = 0; + for (node = mp->suspend_thread.next; node != &mp->suspend_thread; node = node->next) + { + suspend_thread_count++; + } + + if (suspend_thread_count > 0) { rt_kprintf("%-*.*s %04d %04d %04d %d:", maxlen, RT_NAME_MAX, @@ -695,7 +704,7 @@ long list_mempool(void) mp->block_size, mp->block_total_count, mp->block_free_count, - mp->suspend_thread_count); + suspend_thread_count); show_wait_queue(&(mp->suspend_thread)); rt_kprintf("\n"); } @@ -707,7 +716,7 @@ long list_mempool(void) mp->block_size, mp->block_total_count, mp->block_free_count, - mp->suspend_thread_count); + suspend_thread_count); } } } |
