summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-09-17 14:11:14 +0800
committerGitHub <[email protected]>2019-09-17 14:11:14 +0800
commitae7a33c27cf4356b4ba4936eafc8e6b9368d3e3e (patch)
tree33be8eda52fdf06235b571e5ebea2d082f384d40 /components
parentbb014b2061c6b1749467565ab16f1de605455666 (diff)
parent770cc2ffeb1803ad3859d6ba90c895180a4e07d7 (diff)
Merge pull request #3077 from jesven/fix_mempool
修正rt_mp_free有可能唤醒一个错误任务指针的问题
Diffstat (limited to 'components')
-rw-r--r--components/finsh/cmd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c
index 608e962f6c..53b8755af1 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;
+ rt_list_for_each(node, &mp->suspend_thread)
+ {
+ 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);
}
}
}